2018-01-09 17:52:26 +01:00
|
|
|
<template>
|
2019-01-21 15:08:22 +01:00
|
|
|
<div id="mobilizon">
|
2019-04-03 17:29:03 +02:00
|
|
|
<NavBar />
|
|
|
|
<main>
|
|
|
|
<router-view />
|
2019-01-21 15:08:22 +01:00
|
|
|
</main>
|
2019-04-03 17:29:03 +02:00
|
|
|
<mobilizon-footer />
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
2018-01-09 17:52:26 +01:00
|
|
|
</template>
|
|
|
|
|
2018-12-21 15:41:34 +01:00
|
|
|
<script lang="ts">
|
2019-08-13 08:43:37 +02:00
|
|
|
import NavBar from '@/components/NavBar.vue';
|
|
|
|
import { Component, Vue } from 'vue-property-decorator';
|
2019-09-11 09:59:01 +02:00
|
|
|
import {
|
|
|
|
AUTH_ACCESS_TOKEN,
|
|
|
|
AUTH_USER_ACTOR_ID,
|
|
|
|
AUTH_USER_EMAIL,
|
|
|
|
AUTH_USER_ID,
|
|
|
|
AUTH_USER_ROLE,
|
|
|
|
} from '@/constants';
|
2019-08-13 08:43:37 +02:00
|
|
|
import { CURRENT_USER_CLIENT, UPDATE_CURRENT_USER_CLIENT } from '@/graphql/user';
|
|
|
|
import { ICurrentUser } from '@/types/current-user.model';
|
|
|
|
import Footer from '@/components/Footer.vue';
|
|
|
|
import Logo from '@/components/Logo.vue';
|
2019-09-11 09:59:01 +02:00
|
|
|
import { CURRENT_ACTOR_CLIENT, IDENTITIES, UPDATE_CURRENT_ACTOR_CLIENT } from '@/graphql/actor';
|
|
|
|
import { IPerson } from '@/types/actor';
|
2019-09-18 17:32:37 +02:00
|
|
|
import { changeIdentity, initializeCurrentActor, saveActorData } from '@/utils/auth';
|
2018-01-09 17:52:26 +01:00
|
|
|
|
2019-08-13 08:43:37 +02:00
|
|
|
@Component({
|
2019-01-18 14:47:10 +01:00
|
|
|
apollo: {
|
|
|
|
currentUser: {
|
2019-03-22 10:57:14 +01:00
|
|
|
query: CURRENT_USER_CLIENT,
|
|
|
|
},
|
2019-01-18 14:47:10 +01:00
|
|
|
},
|
2018-12-21 17:10:39 +01:00
|
|
|
components: {
|
2019-04-03 17:29:03 +02:00
|
|
|
Logo,
|
2019-03-22 10:57:14 +01:00
|
|
|
NavBar,
|
2019-04-03 17:29:03 +02:00
|
|
|
'mobilizon-footer': Footer,
|
2019-03-22 10:57:14 +01:00
|
|
|
},
|
2018-12-21 17:10:39 +01:00
|
|
|
})
|
|
|
|
export default class App extends Vue {
|
2019-09-11 09:59:01 +02:00
|
|
|
async created() {
|
2019-09-18 17:32:37 +02:00
|
|
|
if (await this.initializeCurrentUser()) {
|
|
|
|
await initializeCurrentActor(this.$apollo.provider.defaultClient);
|
|
|
|
}
|
2018-12-21 15:41:34 +01:00
|
|
|
}
|
|
|
|
|
2019-09-18 17:32:37 +02:00
|
|
|
private async initializeCurrentUser() {
|
2019-01-18 14:47:10 +01:00
|
|
|
const userId = localStorage.getItem(AUTH_USER_ID);
|
|
|
|
const userEmail = localStorage.getItem(AUTH_USER_EMAIL);
|
2019-08-12 16:04:16 +02:00
|
|
|
const accessToken = localStorage.getItem(AUTH_ACCESS_TOKEN);
|
2019-09-09 09:31:08 +02:00
|
|
|
const role = localStorage.getItem(AUTH_USER_ROLE);
|
2019-01-18 14:47:10 +01:00
|
|
|
|
2019-09-09 09:31:08 +02:00
|
|
|
if (userId && userEmail && accessToken && role) {
|
2019-09-18 17:32:37 +02:00
|
|
|
return await this.$apollo.mutate({
|
2019-01-18 14:47:10 +01:00
|
|
|
mutation: UPDATE_CURRENT_USER_CLIENT,
|
|
|
|
variables: {
|
|
|
|
id: userId,
|
|
|
|
email: userEmail,
|
2019-04-01 11:49:54 +02:00
|
|
|
isLoggedIn: true,
|
2019-09-09 09:31:08 +02:00
|
|
|
role,
|
2019-01-18 14:47:10 +01:00
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2019-09-18 17:32:37 +02:00
|
|
|
return false;
|
2019-09-11 09:59:01 +02:00
|
|
|
}
|
2018-12-21 17:10:39 +01:00
|
|
|
}
|
2018-01-09 17:52:26 +01:00
|
|
|
</script>
|
|
|
|
|
2019-04-03 17:29:03 +02:00
|
|
|
<style lang="scss">
|
2019-08-13 08:43:37 +02:00
|
|
|
@import "variables";
|
2019-04-03 17:29:03 +02:00
|
|
|
|
2019-08-13 08:43:37 +02:00
|
|
|
/* Bulma imports */
|
2019-08-26 12:21:23 +02:00
|
|
|
@import "~bulma/sass/utilities/_all";
|
2019-08-13 08:43:37 +02:00
|
|
|
@import "~bulma/sass/base/_all.sass";
|
|
|
|
@import "~bulma/sass/components/card.sass";
|
|
|
|
@import "~bulma/sass/components/media.sass";
|
|
|
|
@import "~bulma/sass/components/message.sass";
|
|
|
|
@import "~bulma/sass/components/modal.sass";
|
|
|
|
@import "~bulma/sass/components/navbar.sass";
|
|
|
|
@import "~bulma/sass/components/pagination.sass";
|
|
|
|
@import "~bulma/sass/components/dropdown.sass";
|
2019-09-09 09:31:08 +02:00
|
|
|
@import "~bulma/sass/components/breadcrumb.sass";
|
2019-09-11 09:59:01 +02:00
|
|
|
@import "~bulma/sass/components/list.sass";
|
2019-09-20 18:22:03 +02:00
|
|
|
@import "~bulma/sass/components/tabs";
|
2019-08-13 08:43:37 +02:00
|
|
|
@import "~bulma/sass/elements/box.sass";
|
|
|
|
@import "~bulma/sass/elements/button.sass";
|
|
|
|
@import "~bulma/sass/elements/container.sass";
|
|
|
|
@import "~bulma/sass/form/_all";
|
|
|
|
@import "~bulma/sass/elements/icon.sass";
|
|
|
|
@import "~bulma/sass/elements/image.sass";
|
|
|
|
@import "~bulma/sass/elements/other.sass";
|
2019-09-18 17:32:37 +02:00
|
|
|
@import "~bulma/sass/elements/progress.sass";
|
2019-08-13 08:43:37 +02:00
|
|
|
@import "~bulma/sass/elements/tag.sass";
|
|
|
|
@import "~bulma/sass/elements/title.sass";
|
|
|
|
@import "~bulma/sass/elements/notification";
|
2019-09-09 09:31:08 +02:00
|
|
|
@import "~bulma/sass/elements/table";
|
2019-08-13 08:43:37 +02:00
|
|
|
@import "~bulma/sass/grid/_all.sass";
|
|
|
|
@import "~bulma/sass/layout/_all.sass";
|
2019-05-17 16:28:15 +02:00
|
|
|
|
2019-08-13 08:43:37 +02:00
|
|
|
/* Buefy imports */
|
|
|
|
@import "~buefy/src/scss/utils/_all";
|
|
|
|
@import "~buefy/src/scss/components/datepicker";
|
|
|
|
@import "~buefy/src/scss/components/notices";
|
|
|
|
@import "~buefy/src/scss/components/dropdown";
|
|
|
|
@import "~buefy/src/scss/components/autocomplete";
|
|
|
|
@import "~buefy/src/scss/components/form";
|
|
|
|
@import "~buefy/src/scss/components/modal";
|
2019-09-18 17:32:37 +02:00
|
|
|
@import "~buefy/src/scss/components/progress";
|
2019-08-13 08:43:37 +02:00
|
|
|
@import "~buefy/src/scss/components/tag";
|
|
|
|
@import "~buefy/src/scss/components/taginput";
|
|
|
|
@import "~buefy/src/scss/components/upload";
|
2019-07-30 16:40:59 +02:00
|
|
|
@import "~buefy/src/scss/components/radio";
|
2019-08-28 11:28:27 +02:00
|
|
|
@import "~buefy/src/scss/components/switch";
|
2019-09-09 09:31:08 +02:00
|
|
|
@import "~buefy/src/scss/components/table";
|
2019-09-20 18:22:03 +02:00
|
|
|
@import "~buefy/src/scss/components/tabs";
|
2019-04-03 17:29:03 +02:00
|
|
|
|
2019-01-21 15:08:22 +01:00
|
|
|
.router-enter-active,
|
|
|
|
.router-leave-active {
|
|
|
|
transition-property: opacity;
|
|
|
|
transition-duration: 0.25s;
|
|
|
|
}
|
2018-07-04 14:29:17 +02:00
|
|
|
|
2019-01-21 15:08:22 +01:00
|
|
|
.router-enter-active {
|
|
|
|
transition-delay: 0.25s;
|
|
|
|
}
|
2018-07-04 14:29:17 +02:00
|
|
|
|
2019-01-21 15:08:22 +01:00
|
|
|
.router-enter,
|
|
|
|
.router-leave-active {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
2019-04-03 17:29:03 +02:00
|
|
|
|
|
|
|
body {
|
|
|
|
background: #f6f7f8;
|
|
|
|
}
|
2018-01-09 17:52:26 +01:00
|
|
|
</style>
|