yunohost-portal/composables/states.ts
2023-08-01 16:32:42 +02:00

17 lines
426 B
TypeScript

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)