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,
|
|
|
|
|
2024-07-13 08:41:35 +00:00
|
|
|
authenticate(url?: string, forgeId?: number) {
|
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-07-23 11:46:22 +00:00
|
|
|
window.location.href = `${useConfig().rootPath}/authorize?${forgeId !== undefined ? `forgeId=${forgeId}` : ''}`;
|
2021-11-03 16:40:31 +00:00
|
|
|
},
|
2023-09-10 09:01:52 +00:00
|
|
|
}) as const;
|