yunohost-portal/composables/states.ts

18 lines
426 B
TypeScript
Raw Normal View History

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())
},
})
}
2023-07-26 05:24:04 +02:00
export const useRedirectUrl = () =>
useState<string | null>('redirectUrl', () => null)