create very rough UI
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
export async function requireAuth() {
|
||||
const res = await fetch('/api/whoami')
|
||||
if (res.status === 401) {
|
||||
window.location.href = '/login.html'
|
||||
}
|
||||
}
|
||||
|
||||
export async function redirectIfAuthed() {
|
||||
const res = await fetch('/api/whoami')
|
||||
if (res.ok) {
|
||||
window.location.href = '/'
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user