2021-11-03 16:40:31 +00:00
|
|
|
import useConfig from '~/compositions/useConfig';
|
2022-05-14 15:45:01 +00:00
|
|
|
import useUserConfig from '~/compositions/useUserConfig';
|
2021-11-03 16:40:31 +00:00
|
|
|
|
|
|
|
export default () =>
|
|
|
|
({
|
2022-05-14 15:45:01 +00:00
|
|
|
isAuthenticated: !!useConfig().user,
|
2021-11-03 16:40:31 +00:00
|
|
|
|
|
|
|
user: useConfig().user,
|
|
|
|
|
2022-05-14 15:45:01 +00:00
|
|
|
authenticate(url?: string) {
|
|
|
|
if (url) {
|
|
|
|
const config = useUserConfig();
|
|
|
|
config.setUserConfig('redirectUrl', url);
|
|
|
|
}
|
2023-08-07 14:05:18 +00:00
|
|
|
window.location.href = `${useConfig().rootPath}/login`;
|
2021-11-03 16:40:31 +00:00
|
|
|
},
|
2023-09-10 09:01:52 +00:00
|
|
|
}) as const;
|