fix: keep session when leaving admin
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+7
-1
@@ -534,10 +534,16 @@ function App() {
|
|||||||
syncRouteFromLocation()
|
syncRouteFromLocation()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleBackFromAdmin = () => {
|
||||||
|
window.history.replaceState({}, document.title, '/')
|
||||||
|
setIsAdminRoute(false)
|
||||||
|
syncRouteFromLocation()
|
||||||
|
}
|
||||||
|
|
||||||
if (isAdminRoute) {
|
if (isAdminRoute) {
|
||||||
return (
|
return (
|
||||||
<div style={{ display: 'contents' }}>
|
<div style={{ display: 'contents' }}>
|
||||||
<AdminDashboard />
|
<AdminDashboard onBack={handleBackFromAdmin} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 [loading, setLoading] = useState(true)
|
||||||
const [error, setError] = useState<string | null>(null)
|
const [error, setError] = useState<string | null>(null)
|
||||||
const [summary, setSummary] = useState<AdminSummary | null>(null)
|
const [summary, setSummary] = useState<AdminSummary | null>(null)
|
||||||
@@ -143,7 +147,7 @@ export default function AdminDashboard() {
|
|||||||
return (
|
return (
|
||||||
<div className="admin-page">
|
<div className="admin-page">
|
||||||
<header className="admin-header">
|
<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} />
|
<ChevronLeft size={16} />
|
||||||
Zur App
|
Zur App
|
||||||
</button>
|
</button>
|
||||||
@@ -165,7 +169,7 @@ export default function AdminDashboard() {
|
|||||||
<div className="admin-page">
|
<div className="admin-page">
|
||||||
<header className="admin-header">
|
<header className="admin-header">
|
||||||
<div className="admin-header-left">
|
<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} />
|
<ChevronLeft size={16} />
|
||||||
Zur App
|
Zur App
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user