Use a pinia store to manage account state
Refactor the existing scattered code dealing with the account state into a pinia store.
This commit is contained in:
parent
fae8b4e2e4
commit
e722876aae
12 changed files with 126 additions and 98 deletions
|
@ -503,16 +503,14 @@ const stretches = computed(() => [
|
|||
)
|
||||
])
|
||||
|
||||
const runtimeConfig = useRuntimeConfig();
|
||||
const sessionStore = useSessionStore();
|
||||
const debugTimezone = ref<undefined | string>();
|
||||
const accountStore = useAccountStore();
|
||||
const timezone = computed({
|
||||
get: () => debugTimezone.value ?? sessionStore.account?.timezone ?? runtimeConfig.public.defaultTimezone,
|
||||
set: (value: string) => { debugTimezone.value = value },
|
||||
get: () => accountStore.activeTimezone,
|
||||
set: (value: string) => { accountStore.timezone = value },
|
||||
});
|
||||
|
||||
const elements = computed(() => tableElementsFromStretches(
|
||||
stretches.value, schedule.value.events, schedule.value.locations, schedule.value.rota, schedule.value.roles, timezone.value
|
||||
stretches.value, schedule.value.events, schedule.value.locations, schedule.value.rota, schedule.value.roles, accountStore.activeTimezone
|
||||
));
|
||||
const totalColumns = computed(() => elements.value.totalColumns);
|
||||
const columnGroups = computed(() => elements.value.columnGroups);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue