chore: fix reactivity of course name in side panel

This commit is contained in:
Livio Bieri 2023-12-07 15:56:41 +01:00 committed by Christian Cueni
parent b414e4cf93
commit e1120ef523
4 changed files with 9 additions and 8 deletions

View File

@ -32,7 +32,6 @@ const user = useUserStore();
getLoginURL({ getLoginURL({
course: props.courseType, course: props.courseType,
lang: user.language, lang: user.language,
next: `/onboarding/${courseType}/account/confirm`,
}) })
" "
class="btn-secondary" class="btn-secondary"

View File

@ -5,7 +5,7 @@ import mood_uk from "@/assets/images/mood_uk.jpg";
import mood_vv from "@/assets/images/mood_vv.jpg"; import mood_vv from "@/assets/images/mood_vv.jpg";
import { useTranslation } from "i18next-vue"; import { useTranslation } from "i18next-vue";
import { startsWith } from "lodash"; import { startsWith } from "lodash";
import { getVVCourseName } from "@/pages/onboarding/vv/helpers"; import { getVVCourseName } from "@/pages/onboarding/vv/composables";
const props = defineProps({ const props = defineProps({
courseType: { courseType: {

View File

@ -10,7 +10,7 @@ import { useEntities } from "@/services/onboarding";
import { useDebounceFn, useFetch } from "@vueuse/core"; import { useDebounceFn, useFetch } from "@vueuse/core";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { useTranslation } from "i18next-vue"; import { useTranslation } from "i18next-vue";
import { getVVCourseName } from "./helpers"; import { getVVCourseName } from "./composables";
type BillingAddressType = { type BillingAddressType = {
first_name: string; first_name: string;

View File

@ -1,16 +1,18 @@
import i18next from "i18next"; import { useTranslation } from "i18next-vue";
export const getVVCourseName = (courseType: string) => { export const getVVCourseName = (courseType: string) => {
const { t } = useTranslation();
if (!["vv-de", "vv-it", "vv-fr"].includes(courseType)) { if (!["vv-de", "vv-it", "vv-fr"].includes(courseType)) {
return ""; return "";
} }
const lookup: { [key: string]: string } = { const lookup: { [key: string]: string } = {
"vv-de": i18next.t("a.Deutsch"), "vv-de": "Deutsch",
"vv-fr": i18next.t("a.Franzosisch"), "vv-fr": "Français",
"vv-it": i18next.t("a.Italienisch"), "vv-it": "Italiano",
}; };
const vv = i18next.t("a.Versicherungsvermittler/-in"); const vv = t("a.Versicherungsvermittler/-in");
return `${vv} (${lookup[courseType]})`; return `${vv} (${lookup[courseType]})`;
}; };