mirror of
https://github.com/YunoHost/yunohost-portal.git
synced 2024-09-03 20:06:23 +02:00
use localeStorage to store isLoggedIn value
This commit is contained in:
parent
a7ddfca923
commit
b82638f247
1 changed files with 15 additions and 1 deletions
|
@ -1,3 +1,17 @@
|
|||
export const useIsLoggedIn = () => useState<boolean>('isLoggedIn', () => false)
|
||||
export const useIsLoggedIn = () => {
|
||||
const isLoggedIn = useState<boolean>(
|
||||
'isLoggedIn',
|
||||
() => localStorage.getItem('isLoggedIn') === 'true',
|
||||
)
|
||||
|
||||
return computed({
|
||||
get: () => isLoggedIn.value,
|
||||
set: (value) => {
|
||||
isLoggedIn.value = value
|
||||
localStorage.setItem('isLoggedIn', value.toString())
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const useRedirectUrl = () =>
|
||||
useState<string | null>('redirectUrl', () => null)
|
||||
|
|
Loading…
Reference in a new issue