diff --git a/js/src/components/NavBar.vue b/js/src/components/NavBar.vue index e3dee29bd..7b77a5fce 100644 --- a/js/src/components/NavBar.vue +++ b/js/src/components/NavBar.vue @@ -94,6 +94,9 @@ import { RouteName } from '@/router'; identities: { query: IDENTITIES, update: ({ identities }) => identities ? identities.map(identity => new Person(identity)) : [], + skip() { + return this.currentUser.isLoggedIn === false; + }, }, config: { query: CONFIG, @@ -114,6 +117,7 @@ export default class NavBar extends Vue { @Watch('currentActor') async initializeListOfIdentities() { + if (!this.currentUser.isLoggedIn) return; const { data } = await this.$apollo.query<{ identities: IPerson[] }>({ query: IDENTITIES, }); diff --git a/js/src/graphql/user.ts b/js/src/graphql/user.ts index c67fc5bbc..ae7ee2629 100644 --- a/js/src/graphql/user.ts +++ b/js/src/graphql/user.ts @@ -18,7 +18,12 @@ mutation ValidateUser($token: String!) { id, email, defaultActor { - id + id, + preferredUsername, + name, + avatar { + url + } } } } diff --git a/js/src/types/current-user.model.ts b/js/src/types/current-user.model.ts index f64387835..8633754a7 100644 --- a/js/src/types/current-user.model.ts +++ b/js/src/types/current-user.model.ts @@ -1,4 +1,5 @@ import { IEvent, IParticipant } from '@/types/event.model'; +import { IPerson } from '@/types/actor/person.model'; export enum ICurrentUserRole { USER = 'USER', @@ -12,5 +13,6 @@ export interface ICurrentUser { isLoggedIn: boolean; role: ICurrentUserRole; participations: IParticipant[]; + defaultActor: IPerson; drafts: IEvent[]; } diff --git a/js/src/views/Account/Register.vue b/js/src/views/Account/Register.vue index 1212f572b..d0144e041 100644 --- a/js/src/views/Account/Register.vue +++ b/js/src/views/Account/Register.vue @@ -103,11 +103,13 @@ export default class Register extends Vue { mutation: REGISTER_PERSON, variables: Object.assign({ email: this.email }, this.person), update: (store, { data }) => { - const identitiesData = store.readQuery<{ identities: IPerson[] }>({ query: IDENTITIES }); + if (this.userAlreadyActivated) { + const identitiesData = store.readQuery<{ identities: IPerson[] }>({ query: IDENTITIES }); - if (identitiesData && data) { - identitiesData.identities.push(data.registerPerson); - store.writeQuery({ query: IDENTITIES, data: identitiesData }); + if (identitiesData && data) { + identitiesData.identities.push(data.registerPerson); + store.writeQuery({ query: IDENTITIES, data: identitiesData }); + } } }, }); diff --git a/js/src/views/Home.vue b/js/src/views/Home.vue index cfc033194..7d9df77a0 100644 --- a/js/src/views/Home.vue +++ b/js/src/views/Home.vue @@ -157,6 +157,7 @@ export default class Home extends Vue { const lastWeek = new Date(); lastWeek.setDate(new Date().getDate() - 7); + if (this.currentUser.isLoggedIn === false) return; const { data } = await this.$apollo.query({ query: LOGGED_USER_PARTICIPATIONS, variables: { diff --git a/js/src/views/User/Register.vue b/js/src/views/User/Register.vue index 2e18654c4..3cbf2945a 100644 --- a/js/src/views/User/Register.vue +++ b/js/src/views/User/Register.vue @@ -36,7 +36,7 @@