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
parent 21325a014d
commit 3fb0265d2d
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
3 changed files with 15 additions and 2 deletions

View File

@ -272,6 +272,11 @@ export default class NavBar extends Vue {
// If we don't have any identities, the user has validated their account, // 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 // is logging for the first time but didn't create an identity somehow
if (this.identities.length === 0) { 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 { try {
await this.$router.push({ await this.$router.push({
name: RouteName.REGISTER_PROFILE, name: RouteName.REGISTER_PROFILE,

View File

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

View File

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