Refresh loggeduser information before the final step of onboarding

Otherwise we endup in a loop

Closes #964

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-11-29 09:50:26 +01:00 committed by tykayn
parent 7ef481dad3
commit 4568a4f4c2
3 changed files with 15 additions and 2 deletions

View File

@ -285,6 +285,11 @@ export default class NavBar extends Vue {
// If we don't have any identities, the user has validated their account,
// is logging for the first time but didn't create an identity somehow
if (this.identities.length === 0) {
console.debug(
"We have no identities listed for current user",
this.identities
);
console.debug("Pushing route to REGISTER_PROFILE");
try {
await this.$router.push({
name: RouteName.REGISTER_PROFILE,

View File

@ -414,7 +414,6 @@ import Subtitle from "../components/Utils/Subtitle.vue";
DateComponent,
EventParticipationCard,
MultiCard,
"settings-onboard": () => import("./User/SettingsOnboard.vue"),
},
metaInfo() {
return {
@ -577,7 +576,9 @@ export default class Home extends Vue {
@Watch("loggedUser")
detectEmptyUserSettings(loggedUser: IUser): void {
console.debug("Try to detect empty user settings", loggedUser);
if (loggedUser?.id && loggedUser?.settings === null) {
console.debug("No user settings, pushing to onboarding assistant");
this.$router.push({
name: RouteName.WELCOME_SCREEN,
params: { step: "1" },

View File

@ -49,7 +49,8 @@
</div>
</template>
<script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";
import { USER_SETTINGS } from "@/graphql/user";
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
import { TIMEZONES } from "../../graphql/config";
import RouteName from "../../router/name";
import { IConfig } from "../../types/config.model";
@ -65,6 +66,7 @@ import { IConfig } from "../../types/config.model";
},
apollo: {
config: TIMEZONES,
loggedUser: USER_SETTINGS,
},
metaInfo() {
return {
@ -82,6 +84,11 @@ export default class SettingsOnboard extends Vue {
get stepIndex(): number {
return this.step - 1;
}
@Watch("stepIndex")
refetchUserSettings() {
this.$apollo.queries.loggedUser.refetch();
}
}
</script>
<style scoped lang="scss">