Fix login redirect — access result.data.token/user

Login/register pages now correctly unwrap API response {data: {token, user}}.
Cleaned up leftover apiFetch code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude CLI Agent
2026-03-29 10:30:05 +00:00
parent 55993b70b2
commit 6c93ae04d0
21 changed files with 824 additions and 22 deletions

View File

@@ -36,14 +36,14 @@ async function apiFetch<T>(path: string, opts: ApiOptions = {}): Promise<T> {
// Auth
export function register(data: { email: string; name: string; phone?: string }) {
return apiFetch<{ token: string; user: User }>("/api/v1/auth/register", {
return apiFetch<{ data: { token: string; user: User } }>("/api/v1/auth/register", {
method: "POST",
body: data,
});
}
export function login(data: { email: string; password?: string }) {
return apiFetch<{ token: string; user: User }>("/api/v1/auth/login", {
return apiFetch<{ data: { token: string; user: User } }>("/api/v1/auth/login", {
method: "POST",
body: data,
});