fix(dashboard-v2): gate session on status user, add favicon
This commit is contained in:
1 parent
60a19ab15e
commit
8f7743c73d
3 files changed
+13
-2
No files matched your search
@@ -3,6 +3,10 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link
|
||||
rel="icon"
|
||||
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' rx='3' fill='%23111'/%3E%3C/svg%3E"
|
||||
/>
|
||||
<title>Status | Archie</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -90,7 +90,10 @@ export interface ComponentVersion {
|
||||
}
|
||||
|
||||
export const api = {
|
||||
authStatus: () => request<{ setup_required?: boolean }>("/api/auth/status"),
|
||||
authStatus: () =>
|
||||
request<{ setup_required?: boolean; user?: unknown }>(
|
||||
"/api/auth/status",
|
||||
),
|
||||
services: () => request<Service[]>("/api/services"),
|
||||
version: () => request<{ components: ComponentVersion[] }>("/api/version"),
|
||||
signIn: (email: string, password: string) =>
|
||||
|
||||
@@ -27,7 +27,11 @@ export function SessionProvider({ children }: { children: ReactNode }) {
|
||||
api
|
||||
.authStatus()
|
||||
.then((status) => {
|
||||
if (live) setState(status.setup_required ? "setup" : "authed");
|
||||
// The status is 200 for anonymous visitors too, with a null user.
|
||||
if (live)
|
||||
setState(
|
||||
status.setup_required ? "setup" : status.user ? "authed" : "guest",
|
||||
);
|
||||
})
|
||||
.catch(() => {
|
||||
// Any failure to prove a session means no session: the login page
|
||||
|
||||
Reference in new issue
Block a user