Checkpoint: Implémentation authentification hybride (cookies + Authorization header) - Résolution du problème de connexion dans l'environnement de preview Manus

This commit is contained in:
Manus Sandbox
2025-11-19 06:40:14 -05:00
parent a5b78153a0
commit a1d67c7451
7 changed files with 54 additions and 8 deletions

View File

@@ -16,7 +16,11 @@ export default function Login() {
const [error, setError] = useState("");
const loginMutation = trpc.auth.login.useMutation({
onSuccess: () => {
onSuccess: (data) => {
// Stocker le token dans localStorage
if (data.token) {
localStorage.setItem('auth_token', data.token);
}
// Rediriger vers le tableau de bord admin
window.location.href = "/admin";
},

View File

@@ -18,7 +18,11 @@ export default function Register() {
const [error, setError] = useState("");
const registerMutation = trpc.auth.register.useMutation({
onSuccess: () => {
onSuccess: (data) => {
// Stocker le token dans localStorage
if (data.token) {
localStorage.setItem('auth_token', data.token);
}
// Rediriger vers le tableau de bord
window.location.href = "/";
},