Merge pull request 'fix(auth): change logout behavior, now sends success code when logout request is processed' (#77) from release/nicolas/v1.1 into main
Reviewed-on: Targo/targo_frontend#77
This commit is contained in:
commit
ff613f2f8d
|
|
@ -9,6 +9,7 @@
|
|||
import { useUiStore } from 'src/stores/ui-store';
|
||||
import { RouteNames } from 'src/router/router-constants';
|
||||
import { ModuleNames, type UserModuleAccess } from 'src/modules/shared/models/user.models';
|
||||
import { useAuthApi } from 'src/modules/auth/composables/use-auth-api';
|
||||
|
||||
const DRAWER_BUTTONS: { i18n_key: string, icon: string, route: RouteNames, required_module?: UserModuleAccess }[] = [
|
||||
{ i18n_key: 'nav_bar.home', icon: "home", route: RouteNames.DASHBOARD, required_module: ModuleNames.DASHBOARD },
|
||||
|
|
@ -21,6 +22,7 @@
|
|||
|
||||
const q = useQuasar();
|
||||
const auth_store = useAuthStore();
|
||||
const authApi = useAuthApi();
|
||||
const ui_store = useUiStore();
|
||||
const router = useRouter();
|
||||
const is_mini = ref(true);
|
||||
|
|
@ -34,11 +36,7 @@
|
|||
};
|
||||
|
||||
const handleLogout = () => {
|
||||
auth_store.logout();
|
||||
|
||||
router.push({ name: 'login' }).catch(err => {
|
||||
console.error('could not log you out: ', err);
|
||||
})
|
||||
authApi.logout();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
|
|
|
|||
|
|
@ -11,8 +11,10 @@ export const useAuthApi = () => {
|
|||
authStore.oidcLogin();
|
||||
};
|
||||
|
||||
const logout = () => {
|
||||
authStore.logout();
|
||||
const logout = async () => {
|
||||
authStore.user = undefined;
|
||||
await authStore.logout();
|
||||
window.location.href = "https://auth.targo.ca/application/o/montargo/end-session/";
|
||||
};
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ export const AuthService = {
|
|||
//TODO: OIDC customer sign-in, eventually
|
||||
},
|
||||
|
||||
logout: () => {
|
||||
logout: async () => {
|
||||
// TODO: logout logic
|
||||
api.post('/auth/logout')
|
||||
await api.post('/auth/logout');
|
||||
},
|
||||
|
||||
refreshToken: () => {
|
||||
|
|
|
|||
|
|
@ -258,6 +258,8 @@
|
|||
dense
|
||||
stack-label
|
||||
label-slot
|
||||
type="file"
|
||||
accept="image/*"
|
||||
>
|
||||
<template #prepend>
|
||||
<q-icon
|
||||
|
|
|
|||
|
|
@ -29,12 +29,8 @@ export const useAuthStore = defineStore('auth', () => {
|
|||
});
|
||||
};
|
||||
|
||||
const logout = () => {
|
||||
user.value = undefined;
|
||||
AuthService.logout();
|
||||
const logout_popup = window.open('https://auth.targo.ca/application/o/montargo/end-session/', 'logoutPopup', 'width=200,height=200');
|
||||
|
||||
setInterval(() => logout_popup?.close(), 2000);
|
||||
const logout = async () => {
|
||||
await AuthService.logout();
|
||||
};
|
||||
|
||||
const handleAuthMessage = async (event: MessageEvent) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user