diff --git a/src/components/loading/DarkCircularProgress.vue b/src/components/loading/DarkCircularProgress.vue
new file mode 100644
index 0000000..2be058e
--- /dev/null
+++ b/src/components/loading/DarkCircularProgress.vue
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue
index e9b295b..1c4d88e 100644
--- a/src/layouts/MainLayout.vue
+++ b/src/layouts/MainLayout.vue
@@ -1,9 +1,6 @@
-
+
-
+
@@ -75,10 +66,7 @@
/>
-
+
(leftDrawer.value || Screen.gt.sm ? true : false),
- set: (val: boolean) => (leftDrawer.value = val),
+ set: (val: boolean) => (leftDrawer.value = val)
})
);
const leftDrawerMini = ref(false);
@@ -181,6 +169,15 @@ export default defineComponent({
}
});
+ function logout() {
+ console.log('vor dem logout');
+ ctx.root.$store.dispatch(
+ 'user/logout',
+ ctx.root.$store.getters['user/session'].token
+ );
+ console.log('nach dem logout');
+ }
+
return {
leftDrawerOpen,
leftDrawerMini,
@@ -188,7 +185,8 @@ export default defineComponent({
links,
pluginChildLinks,
shortcuts,
+ logout
};
- },
+ }
});
diff --git a/src/plugins/user/pages/User.vue b/src/plugins/user/pages/User.vue
index 2232c4c..46b3c02 100644
--- a/src/plugins/user/pages/User.vue
+++ b/src/plugins/user/pages/User.vue
@@ -5,18 +5,12 @@
class="fit row justify-center content-center items-center"
v-if="checkMain"
>
-
+
Name: {{ userObj.firstname }} {{ userObj.lastname }}
E-Mail: {{ userObj.mail }}
Roles:
-
+
diff --git a/src/plugins/user/store/user.ts b/src/plugins/user/store/user.ts
index 977d790..92ccf98 100644
--- a/src/plugins/user/store/user.ts
+++ b/src/plugins/user/store/user.ts
@@ -52,7 +52,12 @@ const mutations: MutationTree = {
const actions: ActionTree = {
login({ commit }, data: LoginData) {
commit('setLoginLoading', true);
- Loading.show({ message: 'Du wirst eingeloggt' });
+ Loading.setDefaults({
+ spinner: () => import('src/components/loading/DarkCircularProgress.vue')
+ });
+ Loading.show({
+ message: 'Du wirst eingeloggt'
+ });
void axios
.post('/auth', data)
.then((response: AxiosResponse) => {
@@ -74,23 +79,32 @@ const actions: ActionTree = {
});
},
logout({ commit }, token) {
- void axios.delete(`/auth/${token}`).then(() => {
- commit('setUser', {
- display_name: '',
- firstname: '',
- lastname: '',
- mail: '',
- roles: [],
- userid: ''
+ Loading.show({ message: 'Du wirst ausgeloggt' });
+ void axios
+ .delete(`/auth/${token}`)
+ .then(() => {
+ commit('setUser', {
+ display_name: '',
+ firstname: '',
+ lastname: '',
+ mail: '',
+ roles: [],
+ userid: ''
+ });
+ commit('setSession', {
+ browser: '',
+ expires: '',
+ lifetime: '',
+ platform: '',
+ token: ''
+ });
+ })
+ .finally(() => {
+ LocalStorage.remove('user');
+ LocalStorage.remove('session');
+ void Router.push({ name: 'login' });
+ Loading.hide();
});
- commit('setSession', {
- browser: '',
- expires: '',
- lifetime: '',
- platform: '',
- token: ''
- });
- });
},
updateUser({ commit, getters }, data) {
commit('setLoginLoading', true);