Authentication updates
This commit is contained in:
parent
98b1daa7d3
commit
3015c98246
15 changed files with 657 additions and 165 deletions
|
|
@ -50,6 +50,11 @@ export interface Stats {
|
|||
|
||||
export async function getStats(): Promise<Stats> {
|
||||
const res = await fetch("/api/stats");
|
||||
|
||||
if (res.status === 401) {
|
||||
throw new Error("UNAUTHORIZED");
|
||||
}
|
||||
|
||||
if (!res.ok) throw new Error(`Failed to fetch stats: ${res.status}`);
|
||||
return res.json() as Promise<Stats>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue