diff --git a/js/public/index.html b/js/public/index.html index b7f91bf39..08101498c 100644 --- a/js/public/index.html +++ b/js/public/index.html @@ -6,7 +6,7 @@ - + mobilizon diff --git a/js/src/App.vue b/js/src/App.vue index c9fbf8be8..81b2635fa 100644 --- a/js/src/App.vue +++ b/js/src/App.vue @@ -24,7 +24,7 @@ import Footer from '@/components/Footer.vue'; import Logo from '@/components/Logo.vue'; import { CURRENT_ACTOR_CLIENT, IDENTITIES, UPDATE_CURRENT_ACTOR_CLIENT } from '@/graphql/actor'; import { IPerson } from '@/types/actor'; -import { changeIdentity, saveActorData } from '@/utils/auth'; +import { changeIdentity, initializeCurrentActor, saveActorData } from '@/utils/auth'; @Component({ apollo: { @@ -40,18 +40,19 @@ import { changeIdentity, saveActorData } from '@/utils/auth'; }) export default class App extends Vue { async created() { - await this.initializeCurrentUser(); - await this.initializeCurrentActor(); + if (await this.initializeCurrentUser()) { + await initializeCurrentActor(this.$apollo.provider.defaultClient); + } } - private initializeCurrentUser() { + private async initializeCurrentUser() { const userId = localStorage.getItem(AUTH_USER_ID); const userEmail = localStorage.getItem(AUTH_USER_EMAIL); const accessToken = localStorage.getItem(AUTH_ACCESS_TOKEN); const role = localStorage.getItem(AUTH_USER_ROLE); if (userId && userEmail && accessToken && role) { - return this.$apollo.mutate({ + return await this.$apollo.mutate({ mutation: UPDATE_CURRENT_USER_CLIENT, variables: { id: userId, @@ -61,26 +62,7 @@ export default class App extends Vue { }, }); } - } - - /** - * We fetch from localStorage the latest actor ID used, - * then fetch the current identities to set in cache - * the current identity used - */ - private async initializeCurrentActor() { - const actorId = localStorage.getItem(AUTH_USER_ACTOR_ID); - - const result = await this.$apollo.query({ - query: IDENTITIES, - }); - const identities = result.data.identities; - if (identities.length < 1) return; - const activeIdentity = identities.find(identity => identity.id === actorId) || identities[0] as IPerson; - - if (activeIdentity) { - return await changeIdentity(this.$apollo.provider.defaultClient, activeIdentity); - } + return false; } } @@ -107,6 +89,7 @@ export default class App extends Vue { @import "~bulma/sass/elements/icon.sass"; @import "~bulma/sass/elements/image.sass"; @import "~bulma/sass/elements/other.sass"; +@import "~bulma/sass/elements/progress.sass"; @import "~bulma/sass/elements/tag.sass"; @import "~bulma/sass/elements/title.sass"; @import "~bulma/sass/elements/notification"; @@ -122,6 +105,7 @@ export default class App extends Vue { @import "~buefy/src/scss/components/autocomplete"; @import "~buefy/src/scss/components/form"; @import "~buefy/src/scss/components/modal"; +@import "~buefy/src/scss/components/progress"; @import "~buefy/src/scss/components/tag"; @import "~buefy/src/scss/components/taginput"; @import "~buefy/src/scss/components/upload"; diff --git a/js/src/components/Event/DateCalendarIcon.vue b/js/src/components/Event/DateCalendarIcon.vue index 72baa994d..62f5b5cb5 100644 --- a/js/src/components/Event/DateCalendarIcon.vue +++ b/js/src/components/Event/DateCalendarIcon.vue @@ -1,5 +1,5 @@