feat(auth): unify mobile-first authentication flow
Some checks failed
Frontend CI/CD / build (push) Has been cancelled
Frontend CI/CD / deploy (push) Has been cancelled

This commit is contained in:
2026-06-23 02:07:14 +03:30
parent 1aa45beba4
commit 22b500dba5
18 changed files with 334 additions and 123 deletions

View File

@@ -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/', {