feat: implement unauthorized error handling and login popup
Deploy Miniplan / build (push) Failing after 42s

This commit is contained in:
2026-04-30 22:39:04 +02:00
parent a3e115824b
commit 213065b86c
8 changed files with 70 additions and 17 deletions
+12 -2
View File
@@ -30,11 +30,21 @@ function getToken(): string | null {
return ""
}
export class UnauthorizedError extends Error {
constructor() {
super("UnauthorizedError");
}
}
export namespace API {
export async function getPlan(id: number) {
return api(`/plan?id=${id}`).then(res => res.json())
.then(data => {
return api(`/plan?id=${id}`).then(res => {
if(res.status == 401) {
throw new UnauthorizedError()
}
return res.json()
}).then(data => {
return {
gottesdienste: data.gottesdienste,
ministranten: data.ministranten,