fix: keep session when leaving admin

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-05 09:32:30 +02:00
parent 5dedb8fac0
commit e1cb2754c4
2 changed files with 14 additions and 4 deletions
+7 -1
View File
@@ -534,10 +534,16 @@ function App() {
syncRouteFromLocation()
}
const handleBackFromAdmin = () => {
window.history.replaceState({}, document.title, '/')
setIsAdminRoute(false)
syncRouteFromLocation()
}
if (isAdminRoute) {
return (
<div style={{ display: 'contents' }}>
<AdminDashboard />
<AdminDashboard onBack={handleBackFromAdmin} />
</div>
)
}
+7 -3
View File
@@ -85,7 +85,11 @@ function TimeSeriesChart({
)
}
export default function AdminDashboard() {
interface AdminDashboardProps {
onBack: () => void
}
export default function AdminDashboard({ onBack }: AdminDashboardProps) {
const [loading, setLoading] = useState(true)
const [error, setError] = useState<string | null>(null)
const [summary, setSummary] = useState<AdminSummary | null>(null)
@@ -143,7 +147,7 @@ export default function AdminDashboard() {
return (
<div className="admin-page">
<header className="admin-header">
<button type="button" className="btn-back" onClick={() => { window.location.href = '/' }}>
<button type="button" className="btn-back" onClick={onBack}>
<ChevronLeft size={16} />
Zur App
</button>
@@ -165,7 +169,7 @@ export default function AdminDashboard() {
<div className="admin-page">
<header className="admin-header">
<div className="admin-header-left">
<button type="button" className="btn-back" onClick={() => { window.location.href = '/' }}>
<button type="button" className="btn-back" onClick={onBack}>
<ChevronLeft size={16} />
Zur App
</button>