mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-16 05:26:31 +00:00
17 lines
527 B
TypeScript
17 lines
527 B
TypeScript
import useConfig from '~/compositions/useConfig';
|
|
import useUserConfig from '~/compositions/useUserConfig';
|
|
|
|
export default () =>
|
|
({
|
|
isAuthenticated: !!useConfig().user,
|
|
|
|
user: useConfig().user,
|
|
|
|
authenticate(url?: string, forgeId?: number) {
|
|
if (url !== undefined) {
|
|
const config = useUserConfig();
|
|
config.setUserConfig('redirectUrl', url);
|
|
}
|
|
window.location.href = `${useConfig().rootPath}/authorize?${forgeId !== undefined ? `forgeId=${forgeId}` : ''}`;
|
|
},
|
|
}) as const;
|