Refactor user storage and update
Rename accounts to users to be consistent with the new naming scheme where account only referes to the logged in user of the session and implement live updates of users via a user store which listens for updates from the event stream.
This commit is contained in:
parent
6336ccdb96
commit
3be7f8be05
24 changed files with 331 additions and 182 deletions
|
@ -11,11 +11,11 @@
|
|||
:selected="crewFilter === undefined"
|
||||
><All Crew></option>
|
||||
<option
|
||||
v-for="account in accounts?.filter(a => a.type === 'crew' || a.type === 'admin')"
|
||||
:key="account.id"
|
||||
:value="String(account.id)"
|
||||
:selected="crewFilter === String(account.id)"
|
||||
>{{ account.name }}</option>
|
||||
v-for="user in [...usersStore.users.values()].filter(a => a.type === 'crew' || a.type === 'admin')"
|
||||
:key="user.id"
|
||||
:value="String(user.id)"
|
||||
:selected="crewFilter === String(user.id)"
|
||||
>{{ user.name }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<Timetable :schedule :eventSlotFilter :shiftSlotFilter />
|
||||
|
@ -104,7 +104,8 @@ const tabs = [
|
|||
];
|
||||
|
||||
const schedule = await useSchedule();
|
||||
const { data: accounts } = await useAccounts();
|
||||
const usersStore = useUsersStore();
|
||||
await usersStore.fetch();
|
||||
const accountStore = useAccountStore();
|
||||
|
||||
const route = useRoute();
|
||||
|
|
|
@ -30,13 +30,13 @@
|
|||
value="assigned"
|
||||
:selected='filter === "assigned"'
|
||||
>Assigned to Me</option>
|
||||
<optgroup v-if="accountStore.isCrew && accounts" label="Crew">
|
||||
<optgroup v-if="accountStore.isCrew" label="Crew">
|
||||
<option
|
||||
v-for="account in accounts.filter(a => a.type === 'crew' || a.type === 'admin')"
|
||||
:key="account.id"
|
||||
:value="`crew-${account.id}`"
|
||||
:selected="filter === `crew-${account.id}`"
|
||||
>{{ account.name }}</option>
|
||||
v-for="user in [...usersStore.users.values()].filter(a => a.type === 'crew' || a.type === 'admin')"
|
||||
:key="user.id"
|
||||
:value="`crew-${user.id}`"
|
||||
:selected="filter === `crew-${user.id}`"
|
||||
>{{ user.name }}</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</label>
|
||||
|
@ -55,7 +55,8 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
const accountStore = useAccountStore();
|
||||
const { data: accounts } = await useAccounts();
|
||||
const usersStore = useUsersStore();
|
||||
await usersStore.fetch();
|
||||
const schedule = await useSchedule();
|
||||
|
||||
const route = useRoute();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue