Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Fix broken logout link in desktop nav view (#580)

SweetPPro46f13bf9cd67
diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index d54c12e1..e5fb1406 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -11,7 +11,8 @@
</template>
<template slot="end">
<navigation v-if="isMobile" :isMobile="isMobile"
- :activeItem="activeItem" :activeGroup="activeGroup" @toggleGroup="toggleGroup" />
+ :activeItem="activeItem" :activeGroup="activeGroup" @toggleGroup="toggleGroup"
+ @doLogout="doLogout" />
<b-navbar-item v-else tag="div">
<a href="#" @click.prevent="doLogout">{{ $t('users.logout') }}</a>
</b-navbar-item>
@@ -65,6 +66,7 @@
<script>
import Vue from 'vue';
import { mapState } from 'vuex';
+import { uris } from './constants';
import Navigation from './components/Navigation.vue';
@@ -79,7 +81,6 @@ export default Vue.extend({
return {
activeItem: {},
activeGroup: {},
- showLogout: Boolean,
windowWidth: window.innerWidth,
};
},
@@ -118,6 +119,20 @@ export default Vue.extend({
}, 500);
});
},
+
+ doLogout() {
+ const http = new XMLHttpRequest();
+
+ const u = uris.root.substr(-1) === '/' ? uris.root : `${uris.root}/`;
+ http.open('get', `${u}api/logout`, false, 'logout_non_user', 'logout_non_user');
+ http.onload = () => {
+ document.location.href = uris.root;
+ };
+ http.onerror = () => {
+ document.location.href = uris.root;
+ };
+ http.send();
+ },
},
computed: {
diff --git a/frontend/src/components/Navigation.vue b/frontend/src/components/Navigation.vue
index a79ddbdb..ccfba521 100644
--- a/frontend/src/components/Navigation.vue
+++ b/frontend/src/components/Navigation.vue
@@ -82,8 +82,6 @@
<script>
-import { uris } from '../constants';
-
export default {
name: 'navigation',
@@ -99,17 +97,7 @@ export default {
},
doLogout() {
- const http = new XMLHttpRequest();
-
- const u = uris.root.substr(-1) === '/' ? uris.root : `${uris.root}/`;
- http.open('get', `${u}api/logout`, false, 'logout_non_user', 'logout_non_user');
- http.onload = () => {
- document.location.href = uris.root;
- };
- http.onerror = () => {
- document.location.href = uris.root;
- };
- http.send();
+ this.$emit('doLogout');
},
},
};