Fix logout (add missing nginx auth proxy) + show name/email in sidebar footer
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
fdbd92d6c2
commit
70908807f6
2 changed files with 15 additions and 4 deletions
|
|
@ -8,6 +8,14 @@ server {
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /twin-optimiser/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 /twin-optimiser/api/ {
|
location /twin-optimiser/api/ {
|
||||||
proxy_pass http://backend:3001/api/;
|
proxy_pass http://backend:3001/api/;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ interface Props {
|
||||||
|
|
||||||
export function Layout({ user, children }: Props) {
|
export function Layout({ user, children }: Props) {
|
||||||
async function logout() {
|
async function logout() {
|
||||||
await fetch('/api/auth/logout', { method: 'POST', credentials: 'include' })
|
await fetch('/twin-optimiser/api/auth/logout', { method: 'POST', credentials: 'include' })
|
||||||
window.location.href = '/'
|
window.location.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -25,7 +25,6 @@ export function Layout({ user, children }: Props) {
|
||||||
<LayoutGrid size={20} strokeWidth={1.75} color="var(--app-color)" />
|
<LayoutGrid size={20} strokeWidth={1.75} color="var(--app-color)" />
|
||||||
<span style={{ color: 'var(--app-color)', fontWeight: 700, fontSize: '0.95rem' }}>Twin Optimiser</span>
|
<span style={{ color: 'var(--app-color)', fontWeight: 700, fontSize: '0.95rem' }}>Twin Optimiser</span>
|
||||||
</div>
|
</div>
|
||||||
<p style={{ color: 'var(--text-muted)', fontSize: '0.72rem', marginTop: '0.2rem' }}>{user.name}</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="nav-scroll" style={{ flex: 1, padding: '0.5rem 0', overflowY: 'auto' }}>
|
<div className="nav-scroll" style={{ flex: 1, padding: '0.5rem 0', overflowY: 'auto' }}>
|
||||||
|
|
@ -34,10 +33,14 @@ export function Layout({ user, children }: Props) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ padding: '0.75rem 1rem', borderTop: '1px solid var(--surface-2)' }}>
|
<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={{
|
<button onClick={logout} style={{
|
||||||
display: 'flex', alignItems: 'center', gap: '0.5rem',
|
display: 'flex', alignItems: 'center', gap: '0.5rem',
|
||||||
background: 'none', border: 'none', color: 'var(--text-muted)',
|
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} />
|
<LogOut size={14} strokeWidth={1.75} />
|
||||||
Sign out
|
Sign out
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue