mobile: login - bouton Google OAuth + show/hide password + message erreur Google
- login.tsx: bouton 'Continuer avec Google' (expo-web-browser + deep link memento://auth) - login.tsx: bouton oeil pour afficher/masquer mot de passe - login.tsx: message d'erreur contextuel si compte Google (pas de mot de passe en DB) - store.ts: loginWithToken() pour recevoir le token après OAuth Google - google-start/route.ts: lance le flux NextAuth Google avec redirect callback - google-callback/route.ts: reçoit la session, génère token mobile, redirige vers memento://auth Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -29,7 +29,7 @@ export const useAuthStore = create<AuthState>((set) => ({
|
||||
body: JSON.stringify({ email, password }),
|
||||
})
|
||||
if (!res.ok) {
|
||||
const data = await res.json()
|
||||
const data = await res.json().catch(() => ({}))
|
||||
throw new Error(data.error || 'Identifiants invalides')
|
||||
}
|
||||
const { token, user } = await res.json()
|
||||
@@ -37,6 +37,11 @@ export const useAuthStore = create<AuthState>((set) => ({
|
||||
set({ user })
|
||||
},
|
||||
|
||||
loginWithToken: async (token, user) => {
|
||||
await setToken(token)
|
||||
set({ user })
|
||||
},
|
||||
|
||||
logout: async () => {
|
||||
await clearToken()
|
||||
set({ user: null })
|
||||
|
||||
Reference in New Issue
Block a user