Fix logout (add missing nginx auth proxy) + show name/email in sidebar footer
The /hk-planner/api/auth/ → central auth nginx block was missing, causing logout to hit the app backend. Also corrects the logout URL and switches from window.location.href='/' to reload(). Shows name + email in sidebar footer. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1a5de8d3fc
commit
872251250e
2 changed files with 15 additions and 4 deletions
|
|
@ -24,6 +24,14 @@ server {
|
|||
try_files $uri =404;
|
||||
}
|
||||
|
||||
location /hk-planner/api/auth/ {
|
||||
proxy_pass http://10.10.10.101:3001/api/auth/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
add_header Cache-Control "no-store";
|
||||
}
|
||||
|
||||
location /hk-planner/api/ {
|
||||
proxy_pass http://backend:3001/api/;
|
||||
proxy_set_header Host $host;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ export function Layout({ user, children }: Props) {
|
|||
useFrameViewport('desktop')
|
||||
|
||||
async function logout() {
|
||||
await fetch('/api/auth/logout', { method: 'POST', credentials: 'include' })
|
||||
window.location.href = '/'
|
||||
await fetch('/hk-planner/api/auth/logout', { method: 'POST', credentials: 'include' })
|
||||
window.location.reload()
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -29,7 +29,6 @@ export function Layout({ user, children }: Props) {
|
|||
<CalendarClock size={20} strokeWidth={1.75} color="#74c69d" />
|
||||
<span style={{ color: '#74c69d', fontWeight: 700, fontSize: '0.95rem' }}>HK Planner</span>
|
||||
</div>
|
||||
<p style={{ color: 'var(--text-muted)', fontSize: '0.72rem', marginTop: '0.2rem' }}>{user.name}</p>
|
||||
</div>
|
||||
|
||||
<div className="nav-scroll" style={{ flex: 1, padding: '0.5rem 0', overflowY: 'auto' }}>
|
||||
|
|
@ -38,10 +37,14 @@ export function Layout({ user, children }: Props) {
|
|||
</div>
|
||||
|
||||
<div style={{ padding: '0.75rem 1rem', borderTop: '1px solid var(--surface-2)' }}>
|
||||
<div style={{ marginBottom: '0.5rem' }}>
|
||||
<div style={{ color: 'var(--text)', fontSize: '0.8rem', fontWeight: 600 }}>{user.name}</div>
|
||||
<div style={{ color: 'var(--text-muted)', fontSize: '0.72rem' }}>{user.email}</div>
|
||||
</div>
|
||||
<button onClick={logout} style={{
|
||||
display: 'flex', alignItems: 'center', gap: '0.5rem',
|
||||
background: 'none', border: 'none', color: 'var(--text-muted)',
|
||||
fontSize: '0.875rem', padding: '0.375rem 0', width: '100%', cursor: 'pointer',
|
||||
fontSize: '0.8rem', padding: '0.375rem 0', width: '100%', cursor: 'pointer',
|
||||
}}>
|
||||
<LogOut size={14} strokeWidth={1.75} />
|
||||
Sign out
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue