cpularp-manager-frontend/src/ts/authorization.ts

16 lines
397 B
TypeScript
Raw Normal View History

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