16 lines
397 B
TypeScript
16 lines
397 B
TypeScript
![]() |
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
|
||
|
})
|
||
|
}
|