cpularp-manager-frontend/src/ts/authorization.ts
2025-04-29 15:54:54 -07:00

14 lines
355 B
TypeScript

export function isLoggedIn(): Promise<boolean> {
return fetch('http://localhost:31337/user/authorized', {
credentials: 'include',
})
.then((res) => {
return res.json().then((res_json) => {
const is_authorized = res_json.message
return Boolean(is_authorized)
})
})
.catch(() => {
return false
})
}