Remove logout from user widget, Fix missing user in article header
This commit is contained in:
parent
2dcfa78a3f
commit
f3db3c6657
|
|
@ -0,0 +1,44 @@
|
||||||
|
<template>
|
||||||
|
<div class="logout-widget">
|
||||||
|
<button class="logout-widget__logout" @click="logout()">Logout</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import LOGOUT_MUTATION from '@/graphql/gql/mutations/logoutUser.gql';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
logout() {
|
||||||
|
this.$apollo.mutate({
|
||||||
|
mutation: LOGOUT_MUTATION,
|
||||||
|
}).then(({data}) => {
|
||||||
|
if (data.logout.success) { location.replace('/') }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import "@/styles/_variables.scss";
|
||||||
|
|
||||||
|
.logout-widget {
|
||||||
|
color: $color-grey;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
&__logout {
|
||||||
|
font-family: $sans-serif-font-family;
|
||||||
|
line-height: 16px;
|
||||||
|
margin: 0 15px 0 20px;
|
||||||
|
background: none;
|
||||||
|
color: inherit;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
outline: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -3,28 +3,17 @@
|
||||||
<user-icon class="user-widget__avatar" :src="avatar"></user-icon>
|
<user-icon class="user-widget__avatar" :src="avatar"></user-icon>
|
||||||
<span class="user-widget__name">{{firstName}} {{lastName}}</span>
|
<span class="user-widget__name">{{firstName}} {{lastName}}</span>
|
||||||
<span class="user-widget__date" v-if="date">{{date}}</span>
|
<span class="user-widget__date" v-if="date">{{date}}</span>
|
||||||
<button class="user-widget__logout" @click="logout()">Logout</button>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import UserIcon from '@/components/icons/UserIcon';
|
import UserIcon from '@/components/icons/UserIcon';
|
||||||
import LOGOUT_MUTATION from '@/graphql/gql/mutations/logoutUser.gql';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['firstName', 'lastName', 'avatar', 'date'],
|
props: ['firstName', 'lastName', 'avatar', 'date'],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
UserIcon
|
UserIcon
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
logout() {
|
|
||||||
this.$apollo.mutate({
|
|
||||||
mutation: LOGOUT_MUTATION,
|
|
||||||
}).then(({data}) => {
|
|
||||||
if (data.logout.success) { location.replace('/') }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -47,18 +36,6 @@
|
||||||
font-family: $sans-serif-font-family;
|
font-family: $sans-serif-font-family;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__logout {
|
|
||||||
font-family: $sans-serif-font-family;
|
|
||||||
line-height: 16px;
|
|
||||||
margin: 0 15px 0 20px;
|
|
||||||
background: none;
|
|
||||||
color: inherit;
|
|
||||||
border: none;
|
|
||||||
padding: 0;
|
|
||||||
cursor: pointer;
|
|
||||||
outline: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__avatar {
|
&__avatar {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,10 @@
|
||||||
<header class="header skillbox__header">
|
<header class="header skillbox__header">
|
||||||
<top-navigation></top-navigation>
|
<top-navigation></top-navigation>
|
||||||
<router-link to="/" class="skillbox__header-logo">skillbox</router-link>
|
<router-link to="/" class="skillbox__header-logo">skillbox</router-link>
|
||||||
<user-widget v-bind="me"></user-widget>
|
<div class="user-header">
|
||||||
|
<user-widget v-bind="me"></user-widget>
|
||||||
|
<logout-widget></logout-widget>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<filter-bar v-if="showFilter"></filter-bar>
|
<filter-bar v-if="showFilter"></filter-bar>
|
||||||
|
|
@ -18,13 +20,15 @@
|
||||||
import TopNavigation from '@/components/TopNavigation.vue';
|
import TopNavigation from '@/components/TopNavigation.vue';
|
||||||
import UserWidget from '@/components/UserWidget.vue';
|
import UserWidget from '@/components/UserWidget.vue';
|
||||||
import FilterBar from '@/components/FilterBar.vue';
|
import FilterBar from '@/components/FilterBar.vue';
|
||||||
|
import LogoutWidget from '@/components/LogoutWidget.vue';
|
||||||
import ME_QUERY from '@/graphql/gql/meQuery.gql';
|
import ME_QUERY from '@/graphql/gql/meQuery.gql';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
TopNavigation,
|
TopNavigation,
|
||||||
UserWidget,
|
UserWidget,
|
||||||
FilterBar
|
FilterBar,
|
||||||
|
LogoutWidget
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -151,4 +155,8 @@
|
||||||
-ms-grid-column: 1;
|
-ms-grid-column: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-header {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue