feat(auth): unify mobile-first authentication flow
This commit is contained in:
@@ -7,6 +7,18 @@ const normalizeDigits = (value: string) =>
|
||||
|
||||
// --- Auth Endpoints ---
|
||||
|
||||
export type ResolveAuthMobileStatus = "existing_user" | "new_user"
|
||||
|
||||
export const resolveAuthMobile = async (mobile: string): Promise<{ status: ResolveAuthMobileStatus }> => {
|
||||
const normalizedMobile = normalizeDigits(mobile)
|
||||
const response = await authFetch("/api/users/auth/resolve-mobile/", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ mobile: normalizedMobile }),
|
||||
})
|
||||
if (!response.ok) throw await buildApiError(response)
|
||||
return response.json()
|
||||
}
|
||||
|
||||
export const loginWithPassword = async (mobile: string, password: string) => {
|
||||
const normalizedMobile = normalizeDigits(mobile)
|
||||
const response = await authFetch('/api/users/login/', {
|
||||
|
||||
Reference in New Issue
Block a user