mirror of
https://github.com/clucraft/PriceGhost.git
synced 2026-04-25 00:36:32 +02:00
Display user's name instead of email in profile button
- Add name field to auth login/register responses - Update User interface in AuthContext to include name - Show name (or email as fallback) in navbar dropdown Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
5a048aefd6
commit
2ecb02677e
3 changed files with 5 additions and 2 deletions
|
|
@ -69,6 +69,7 @@ router.post('/register', async (req: Request, res: Response) => {
|
|||
user: {
|
||||
id: user.id,
|
||||
email: user.email,
|
||||
name: user.name || null,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
|
@ -107,6 +108,7 @@ router.post('/login', async (req: Request, res: Response) => {
|
|||
user: {
|
||||
id: user.id,
|
||||
email: user.email,
|
||||
name: user.name || null,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -262,9 +262,9 @@ export default function Layout({ children }: LayoutProps) {
|
|||
onClick={() => setIsDropdownOpen(!isDropdownOpen)}
|
||||
>
|
||||
<span className="user-dropdown-avatar">
|
||||
{user.email.charAt(0).toUpperCase()}
|
||||
{(user.name || user.email).charAt(0).toUpperCase()}
|
||||
</span>
|
||||
<span className="user-dropdown-email">{user.email}</span>
|
||||
<span className="user-dropdown-email">{user.name || user.email}</span>
|
||||
<svg
|
||||
className="user-dropdown-arrow"
|
||||
width="12"
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import { authApi } from '../api/client';
|
|||
interface User {
|
||||
id: number;
|
||||
email: string;
|
||||
name: string | null;
|
||||
}
|
||||
|
||||
interface AuthContextType {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue