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:
@@ -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";
|
||||
},
|
||||
|
||||
@@ -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 = "/";
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user