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) {
|
2024-06-06 13:16:59 +00:00
|
|
|
if (url !== undefined) {
|
2022-05-14 15:45:01 +00:00
|
|
|
const config = useUserConfig();
|
|
|
|
config.setUserConfig('redirectUrl', url);
|
|
|
|
}
|
2024-06-21 07:55:30 +00:00
|
|
|
window.location.href = `${useConfig().rootPath}/authorize`;
|
2021-11-03 16:40:31 +00:00
|
|
|
},
|
2023-09-10 09:01:52 +00:00
|
|
|
}) as const;
|