massive state refactor, mostly fixes #3

This commit is contained in:
Michael Dausmann
2023-04-12 00:05:32 +10:00
parent 4d288c7468
commit 028a7dda45
11 changed files with 160 additions and 171 deletions

View File

@@ -5,21 +5,12 @@
middleware: ['auth'],
});
const authStore = useAuthStore();
const { activeMembership } = storeToRefs(authStore);
const notesStore = useNotesStore();
const { notes } = storeToRefs(notesStore); // ensure the notes list is reactive
onMounted(async () => {
await authStore.initUser();
});
watchEffect(async () => {
if (activeMembership.value) {
await notesStore.fetchNotesForCurrentUser();
}
})
await notesStore.fetchNotesForCurrentUser();
});
</script>
<template>
<div>