feat: profile avatar, callback setUser fix, admin description/thumbnail, pagination limit=100
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 26s

This commit is contained in:
2026-03-15 02:45:50 +01:00
parent 61d8a5257d
commit 8e78ce50b5
5 changed files with 144 additions and 64 deletions

View File

@@ -1,29 +1,38 @@
import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { apiFetch } from '../lib/api';
import { useAuthContext } from '../context/AuthContext';
import type { User } from '../context/AuthContext';
interface SessionResponse {
success: boolean;
data: { user: User };
}
export default function CallbackPage() {
const navigate = useNavigate();
const { setUser } = useAuthContext();
const [error, setError] = useState<string | null>(null);
useEffect(() => {
const params = new URLSearchParams(window.location.search);
const token = params.get('token');
// Pas de token dans l'URL → retour silencieux
if (!token) {
navigate('/', { replace: true });
return;
}
// Envoie le token au backend → backend valide + pose le cookie httpOnly
apiFetch<void>('/auth/session', {
apiFetch<SessionResponse>('/auth/session', {
method: 'POST',
body: JSON.stringify({ token }),
})
.then(() => navigate('/', { replace: true }))
.then((res) => {
setUser(res.data.user);
navigate('/', { replace: true });
})
.catch(() => setError("Échec de l'authentification. Réessaie."));
}, [navigate]);
}, [navigate, setUser]);
if (error) {
return (