Add Login page

This commit is contained in:
2023-07-15 15:02:03 +08:00
parent 0519334686
commit a573d60191
3 changed files with 89 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ export async function check_auth_status() {
const re = await fetch("/api/user");
const u: JSONResult<BUser> = await re.json();
if (u.ok) return true;
if (u.status !== 404 && u.status !== 1) {
if (u.status !== 404 && u.status !== 1 && u.status !== 401) {
throw Error(u.error);
}
const re2 = await fetch("/api/status");
@@ -20,5 +20,5 @@ export async function check_auth_status() {
if (!parse_bool(localStorage.getItem("skip_create_root_user"), false)) {
set_state("#/create_root_user");
}
}
} else set_state("#/login");
}