Merge branch 'bug/fix-logout' into 'master'

Fix logout

Closes #171

See merge request framasoft/mobilizon!189
This commit is contained in:
Thomas Citharel 2019-09-23 11:39:44 +02:00
commit 4dd495b365

View File

@ -20,7 +20,7 @@
<span>{{ currentActor.preferredUsername }}</span> <span>{{ currentActor.preferredUsername }}</span>
</template> </template>
<b-navbar-item tag="span" v-for="identity in identities" v-if="identities.length > 0" :active="identity.id === currentActor.id"> <b-navbar-item tag="span" v-for="identity in identities" v-if="identities.length > 0" :active="identity.id === currentActor.id" :key="identity.id">
<span @click="setIdentity(identity)"> <span @click="setIdentity(identity)">
<div class="media-left"> <div class="media-left">
<figure class="image is-32x32" v-if="identity.avatar"> <figure class="image is-32x32" v-if="identity.avatar">
@ -49,7 +49,9 @@
<router-link :to="{ name: AdminRouteName.DASHBOARD }">{{ $t('Administration') }}</router-link> <router-link :to="{ name: AdminRouteName.DASHBOARD }">{{ $t('Administration') }}</router-link>
</b-navbar-item> </b-navbar-item>
<b-navbar-item v-on:click="logout()">{{ $t('Log out') }}</b-navbar-item> <b-navbar-item tag="span">
<span @click="logout">{{ $t('Log out') }}</span>
</b-navbar-item>
</b-navbar-dropdown> </b-navbar-dropdown>
<b-navbar-item v-else tag="div"> <b-navbar-item v-else tag="div">
@ -145,9 +147,15 @@ export default class NavBar extends Vue {
async logout() { async logout() {
await logout(this.$apollo.provider.defaultClient); await logout(this.$apollo.provider.defaultClient);
this.$buefy.notification.open({
message: this.$t('You have been disconnected') as string,
type: 'is-success',
position: 'is-bottom-right',
duration: 5000,
});
if (this.$route.name === RouteName.HOME) return; if (this.$route.name === RouteName.HOME) return;
return this.$router.push({ name: RouteName.HOME }); await this.$router.push({ name: RouteName.HOME });
} }
async setIdentity(identity: IPerson) { async setIdentity(identity: IPerson) {
@ -159,8 +167,6 @@ export default class NavBar extends Vue {
@import "../variables.scss"; @import "../variables.scss";
nav { nav {
/*border-bottom: solid 1px #0a0a0a;*/
.navbar-dropdown .navbar-item { .navbar-dropdown .navbar-item {
cursor: pointer; cursor: pointer;
@ -175,6 +181,10 @@ nav {
img { img {
max-height: 2.5em; max-height: 2.5em;
} }
&:hover {
background: whitesmoke;
}
} }
.navbar-item.has-dropdown a.navbar-link figure { .navbar-item.has-dropdown a.navbar-link figure {