Files
faunosteo/apps/app/src/auth/useAuthFailureMessage.ts
T
bchanot c517ea267b feat(app): identity screens and /app shell — auth store, login/signup/reset flows, dashboard, account
- state/authStore: session subscription (initialize + onAuthStateChange), profile + roles load, recovery flag, URL failure; services/localeSync: profiles.locale <-> localeStore
- routes: /login, /signup, /forgot-password, /reset-password, /auth/callback; guards RequireAuth (next=) and RedirectIfSignedIn; /app (dashboard), /app/account behind the guard
- shell: AppLayout (desktop sidebar, light top bar, mobile drawer), SidebarNav, UserBadge, SignOutButton
- account: personal / professional / preferences / security sections, one save each, Zod validation with i18n keys
- ui: Icon, FormField, Notice, ButtonLink (buttonClassName shared), PasswordField, OAuthButtons (config-driven)
- Home header: Mon espace / Se connecter when Supabase is configured; local tool routes untouched
- i18n: auth.*, shell.*, dashboard.*, account.*, home.space.* in fr + en
2026-10-11 23:29:13 +02:00

13 lines
481 B
TypeScript

import { AuthFailure, ProfileError } from '@faunosteo/supabase'
import { useT } from '@/i18n/useT'
/** One sentence per failure kind; anything else is the generic line. */
export function useAuthFailureMessage(): (error: unknown) => string {
const t = useT()
return (error) => {
if (error instanceof AuthFailure) return t(`auth.failure.${error.kind}`)
if (error instanceof ProfileError) return t('account.error.save_failed')
return t('auth.failure.unknown')
}
}