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
|
@ -1,14 +1,14 @@
|
|||
<template>
|
||||
<main>
|
||||
<h1>Account Settings</h1>
|
||||
<p v-if="sessionStore.account?.type !== 'anonymous'">
|
||||
Name: {{ sessionStore.account?.name }}
|
||||
<p v-if="accountStore.type !== 'anonymous'">
|
||||
Name: {{ accountStore.name }}
|
||||
</p>
|
||||
<p>Access: {{ sessionStore.account?.type }}</p>
|
||||
<p>Access: {{ accountStore.type }}</p>
|
||||
<form @submit.prevent="changeSettings">
|
||||
<label>
|
||||
Timezone
|
||||
<input type="text" v-model="timezone">
|
||||
<input type="text" v-model="timezone" :placeholder="accountStore.defaultTimezone">
|
||||
</label>
|
||||
<button type="submit">
|
||||
Save
|
||||
|
@ -35,8 +35,9 @@ definePageMeta({
|
|||
});
|
||||
|
||||
const sessionStore = useSessionStore();
|
||||
const accountStore = useAccountStore();
|
||||
|
||||
const timezone = ref(sessionStore.account?.timezone ?? "");
|
||||
const timezone = ref(accountStore.timezone ?? "");
|
||||
|
||||
async function changeSettings() {
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue