fix: Admin settings checkboxes not updating (#7462)

This commit is contained in:
Brian Choromanski
2026-04-14 11:58:07 -04:00
committed by GitHub
parent 6e2c849412
commit af79a751fb
2 changed files with 12 additions and 7 deletions

View File

@@ -3,7 +3,7 @@
<BaseCardSectionTitle :title="$t('group.group-preferences')" />
<div class="mb-6">
<v-checkbox
v-model="preferences.privateGroup"
v-model="local.privateGroup"
hide-details
density="compact"
color="primary"
@@ -21,7 +21,7 @@
</div>
<div class="mb-6">
<v-checkbox
v-model="preferences.showAnnouncements"
v-model="local.showAnnouncements"
hide-details
density="compact"
color="primary"
@@ -40,4 +40,6 @@
import type { ReadGroupPreferences } from "~/lib/api/types/user";
const preferences = defineModel<ReadGroupPreferences>({ required: true });
const local = reactive({ ...preferences.value });
watch(local, (newVal) => { preferences.value = { ...newVal }; });
</script>

View File

@@ -2,7 +2,7 @@
<div v-if="preferences">
<BaseCardSectionTitle :title="$t('household.household-preferences')" />
<div class="mb-6">
<v-checkbox v-model="preferences.privateHousehold" hide-details density="compact" :label="$t('household.private-household')" color="primary" />
<v-checkbox v-model="local.privateHousehold" hide-details density="compact" :label="$t('household.private-household')" color="primary" />
<div class="ml-8">
<p class="text-subtitle-2 my-0 py-0">
{{ $t("household.private-household-description") }}
@@ -11,7 +11,7 @@
</div>
</div>
<div class="mb-6">
<v-checkbox v-model="preferences.lockRecipeEditsFromOtherHouseholds" hide-details density="compact" :label="$t('household.lock-recipe-edits-from-other-households')" color="primary" />
<v-checkbox v-model="local.lockRecipeEditsFromOtherHouseholds" hide-details density="compact" :label="$t('household.lock-recipe-edits-from-other-households')" color="primary" />
<div class="ml-8">
<p class="text-subtitle-2 my-0 py-0">
{{ $t("household.lock-recipe-edits-from-other-households-description") }}
@@ -20,7 +20,7 @@
</div>
<div class="mb-6">
<v-checkbox
v-model="preferences.showAnnouncements"
v-model="local.showAnnouncements"
hide-details
density="compact"
color="primary"
@@ -33,7 +33,7 @@
</div>
</div>
<v-select
v-model="preferences.firstDayOfWeek"
v-model="local.firstDayOfWeek"
:prepend-icon="$globals.icons.calendarWeekBegin"
:items="allDays"
item-title="name"
@@ -48,7 +48,7 @@
</BaseCardSectionTitle>
<div class="preference-container">
<div v-for="p in recipePreferences" :key="p.key">
<v-checkbox v-model="preferences[p.key]" hide-details density="compact" :label="p.label" color="primary" />
<v-checkbox v-model="local[p.key]" hide-details density="compact" :label="p.label" color="primary" />
<p class="ml-8 text-subtitle-2 my-0 py-0">
{{ p.description }}
</p>
@@ -61,6 +61,9 @@
import type { ReadHouseholdPreferences } from "~/lib/api/types/household";
const preferences = defineModel<ReadHouseholdPreferences>({ required: true });
const local = reactive({ ...preferences.value });
watch(local, (newVal) => { preferences.value = { ...newVal }; });
const i18n = useI18n();
type Preference = {