2018-01-09 16:52:26 +00:00
|
|
|
<template>
|
2019-01-21 14:08:22 +00:00
|
|
|
<div id="mobilizon">
|
2019-04-03 15:29:03 +00:00
|
|
|
<NavBar />
|
|
|
|
<main>
|
|
|
|
<router-view />
|
2019-01-21 14:08:22 +00:00
|
|
|
</main>
|
2019-04-03 15:29:03 +00:00
|
|
|
<mobilizon-footer />
|
2019-01-21 14:08:22 +00:00
|
|
|
</div>
|
2018-01-09 16:52:26 +00:00
|
|
|
</template>
|
|
|
|
|
2018-12-21 14:41:34 +00:00
|
|
|
<script lang="ts">
|
2018-12-21 16:10:39 +00:00
|
|
|
import NavBar from '@/components/NavBar.vue';
|
|
|
|
import { Component, Vue } from 'vue-property-decorator';
|
2019-01-18 13:47:10 +00:00
|
|
|
import { AUTH_TOKEN, AUTH_USER_ACTOR, AUTH_USER_EMAIL, AUTH_USER_ID } from '@/constants';
|
|
|
|
import { CURRENT_USER_CLIENT, UPDATE_CURRENT_USER_CLIENT } from '@/graphql/user';
|
2019-03-22 09:57:14 +00:00
|
|
|
import { ICurrentUser } from '@/types/current-user.model';
|
2019-04-03 15:29:03 +00:00
|
|
|
import Footer from '@/components/Footer.vue';
|
|
|
|
import Logo from '@/components/Logo.vue';
|
2018-01-09 16:52:26 +00:00
|
|
|
|
2018-12-21 16:10:39 +00:00
|
|
|
@Component({
|
2019-01-18 13:47:10 +00:00
|
|
|
apollo: {
|
|
|
|
currentUser: {
|
2019-03-22 09:57:14 +00:00
|
|
|
query: CURRENT_USER_CLIENT,
|
|
|
|
},
|
2019-01-18 13:47:10 +00:00
|
|
|
},
|
2018-12-21 16:10:39 +00:00
|
|
|
components: {
|
2019-04-03 15:29:03 +00:00
|
|
|
Logo,
|
2019-03-22 09:57:14 +00:00
|
|
|
NavBar,
|
2019-04-03 15:29:03 +00:00
|
|
|
'mobilizon-footer': Footer,
|
2019-03-22 09:57:14 +00:00
|
|
|
},
|
2018-12-21 16:10:39 +00:00
|
|
|
})
|
|
|
|
export default class App extends Vue {
|
2019-01-18 13:47:10 +00:00
|
|
|
currentUser!: ICurrentUser;
|
2018-12-21 14:41:34 +00:00
|
|
|
|
2018-12-21 16:10:39 +00:00
|
|
|
actor = localStorage.getItem(AUTH_USER_ACTOR);
|
2018-12-21 14:41:34 +00:00
|
|
|
|
2019-04-03 15:29:03 +00:00
|
|
|
async mounted () {
|
|
|
|
await this.initializeCurrentUser();
|
2018-12-21 16:10:39 +00:00
|
|
|
}
|
2018-12-21 14:41:34 +00:00
|
|
|
|
2019-01-21 14:08:22 +00:00
|
|
|
getUser (): ICurrentUser|false {
|
2019-01-18 13:47:10 +00:00
|
|
|
return this.currentUser.id ? this.currentUser : false;
|
2018-12-21 14:41:34 +00:00
|
|
|
}
|
|
|
|
|
2019-01-18 13:47:10 +00:00
|
|
|
private initializeCurrentUser() {
|
|
|
|
const userId = localStorage.getItem(AUTH_USER_ID);
|
|
|
|
const userEmail = localStorage.getItem(AUTH_USER_EMAIL);
|
|
|
|
const token = localStorage.getItem(AUTH_TOKEN);
|
|
|
|
|
|
|
|
if (userId && userEmail && token) {
|
|
|
|
return this.$apollo.mutate({
|
|
|
|
mutation: UPDATE_CURRENT_USER_CLIENT,
|
|
|
|
variables: {
|
|
|
|
id: userId,
|
|
|
|
email: userEmail,
|
2019-04-01 09:49:54 +00:00
|
|
|
isLoggedIn: true,
|
2019-01-18 13:47:10 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2018-12-21 16:10:39 +00:00
|
|
|
}
|
2018-01-09 16:52:26 +00:00
|
|
|
</script>
|
|
|
|
|
2019-04-03 15:29:03 +00:00
|
|
|
<style lang="scss">
|
|
|
|
@import "variables";
|
|
|
|
|
|
|
|
// Import Bulma and Buefy styles
|
|
|
|
@import "~bulma/sass/utilities/_all";
|
|
|
|
@import "~bulma/sass/base/_all.sass";
|
|
|
|
@import "~bulma/sass/elements/button.sass";
|
|
|
|
@import "~bulma/sass/elements/container.sass";
|
|
|
|
@import "~bulma/sass/components/card.sass";
|
|
|
|
@import "~bulma/sass/components/pagination.sass";
|
|
|
|
@import "~bulma/sass/elements/form.sass";
|
|
|
|
@import "~bulma/sass/layout/hero.sass";
|
|
|
|
@import "~bulma/sass/elements/title.sass";
|
|
|
|
@import "~bulma/sass/elements/image.sass";
|
|
|
|
@import "~bulma/sass/elements/box.sass";
|
|
|
|
@import "~bulma/sass/components/navbar.sass";
|
|
|
|
@import "~bulma/sass/components/modal.sass";
|
|
|
|
@import "~bulma/sass/grid/_all.sass";
|
|
|
|
@import "~bulma/sass/layout/section.sass";
|
|
|
|
@import "~bulma/sass/layout/footer.sass";
|
|
|
|
@import "~buefy/src/scss/utils/_all";
|
|
|
|
@import "~buefy/src/scss/components/datepicker";
|
|
|
|
@import "~buefy/src/scss/components/modal";
|
|
|
|
@import "~buefy/src/scss/components/form";
|
|
|
|
@import "~buefy/src/scss/components/dropdown";
|
|
|
|
|
2019-01-21 14:08:22 +00:00
|
|
|
.router-enter-active,
|
|
|
|
.router-leave-active {
|
|
|
|
transition-property: opacity;
|
|
|
|
transition-duration: 0.25s;
|
|
|
|
}
|
2018-07-04 12:29:17 +00:00
|
|
|
|
2019-01-21 14:08:22 +00:00
|
|
|
.router-enter-active {
|
|
|
|
transition-delay: 0.25s;
|
|
|
|
}
|
2018-07-04 12:29:17 +00:00
|
|
|
|
2019-01-21 14:08:22 +00:00
|
|
|
.router-enter,
|
|
|
|
.router-leave-active {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
2019-04-03 15:29:03 +00:00
|
|
|
|
|
|
|
body {
|
|
|
|
background: #f6f7f8;
|
|
|
|
}
|
2018-01-09 16:52:26 +00:00
|
|
|
</style>
|