diff --git a/lib/auth/context.tsx b/lib/auth/context.tsx index edfd0a8..fc9fdad 100644 --- a/lib/auth/context.tsx +++ b/lib/auth/context.tsx @@ -100,6 +100,15 @@ export function AuthProvider({ children }: { children: React.ReactNode }) { if (session) { setUser(session) localStorage.setItem('user', JSON.stringify(session)) + // * Fetch full profile (including display_name) from API; preserve org_id/role from session + try { + const userData = await apiRequest('/auth/user/me') + const merged = { ...userData, org_id: session.org_id, role: session.role } + setUser(merged) + localStorage.setItem('user', JSON.stringify(merged)) + } catch (e) { + console.error('Failed to fetch full profile', e) + } } else { // * Session invalid/expired localStorage.removeItem('user') diff --git a/package-lock.json b/package-lock.json index 944e9a8..4254aa7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "name": "pulse-frontend", "version": "0.1.3", "dependencies": { - "@ciphera-net/ui": "^0.0.47", + "@ciphera-net/ui": "^0.0.48", "@ducanh2912/next-pwa": "^10.2.9", "axios": "^1.13.2", "country-flag-icons": "^1.6.4", @@ -1467,9 +1467,9 @@ } }, "node_modules/@ciphera-net/ui": { - "version": "0.0.47", - "resolved": "https://npm.pkg.github.com/download/@ciphera-net/ui/0.0.47/515f5980070b669351583081909e684cd4e1ad04", - "integrity": "sha512-Gn2Qgy7p+Qo0Ko92nVs3RbQGQHDcolm+EHVCGzRDyFiZXMW7mgV+yFoUOxdq2sOqcbiIiZOZU+r59inXk1Xe2g==", + "version": "0.0.48", + "resolved": "https://npm.pkg.github.com/download/@ciphera-net/ui/0.0.48/20eedc6319567fff80530d865ebbed6e6f784dab", + "integrity": "sha512-kDrGV7tzAjeiz7MtK5G81iY08Zg4NxHTlDNkH5/Pkl2aSpyraf04/J/pGshChjdXMdioXrJA7JU8YH+GlI1LfA==", "dependencies": { "@radix-ui/react-icons": "^1.3.0", "clsx": "^2.1.0", diff --git a/package.json b/package.json index e548d6f..b247ca7 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "type-check": "tsc --noEmit" }, "dependencies": { - "@ciphera-net/ui": "^0.0.47", + "@ciphera-net/ui": "^0.0.48", "@ducanh2912/next-pwa": "^10.2.9", "axios": "^1.13.2", "country-flag-icons": "^1.6.4",