Skip to content

IA-938 "feat(profile): integrate real API for history and sessions"

khadija.elbachouri a demandé de fusionner feature/IA-938 vers develop

Description

Replaced all static/mock data in the profile-related views with real API integration.

HistoryView (history-view.tsx)

  • Removed hardcoded activityHistory and activeSessions arrays
  • Added fetchActivityLog and fetchSessions using axiosInstance with loading/error states (Skeleton, Alert)
  • handleSessionLogout and handleLogoutAll now call real DELETE endpoints
  • Added getActivityIcon() helper to derive icons dynamically from activity type
  • Date formatting now handles both array (Java LocalDateTime) and ISO string formats

ProfilePhotoView (profile-photo-view.tsx)

  • Admin photo save now uses a dedicated multipart/form-data PUT request to /api/user-management/admins/current-user/photo instead of the generic updateAdmin store method
  • Added axiosInstance import for direct API calls

axios.ts (endpoints)

  • Updated baseURL to use NEXT_PUBLIC_HOST_GATEWAY_API_URL env variable instead of CONFIG.site.serverUrl
  • Added admin.currentUser and admin.currentUserPhoto endpoints
  • Added history.activityLog and history.sessions endpoints

Rapports de requête de fusion