targo-frontend/src/modules/auth/composables/use-auth-api.ts

25 lines
566 B
TypeScript

import { useAuthStore } from "../../../stores/auth-store";
export const useAuthApi = () => {
const authStore = useAuthStore();
const login = () => {
authStore.login();
};
const oidcLogin = () => {
authStore.oidcLogin();
};
const logout = async () => {
authStore.user = undefined;
await authStore.logout();
window.location.href = "https://auth.targo.ca/application/o/montargo/end-session/";
};
return {
login,
oidcLogin,
logout,
};
};