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,
    };
};