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:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user