massive state refactor, mostly fixes #3
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user