Profile image works, editing profile works, now uses first/last name

This commit is contained in:
augmentedpotato
2026-04-14 15:02:57 -06:00
parent fbcab5d097
commit 917d318566
7 changed files with 212 additions and 53 deletions

View File

@@ -79,15 +79,21 @@ export function AuthProvider({ children }) {
return userInfo;
}, [refreshUser]);
const register = useCallback(async ({ username, password, email, fullName, phone }) => {
const register = useCallback(async ({ username, password, email, firstName, lastName, phone }) => {
const res = await fetch("/api/v1/auth/register", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ username, password, email, fullName, phone }),
body: JSON.stringify({ username, password, email, firstName, lastName, phone }),
});
const data = await res.json();
if (!res.ok) {
if (data.errors && typeof data.errors === "object") {
const fieldErrors = Object.entries(data.errors)
.map(([field, msg]) => `${field}: ${msg}`)
.join(", ");
throw new Error(fieldErrors || data.message || "Registration failed");
}
throw new Error(data.message || "Registration failed");
}