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

@@ -1,8 +1,6 @@
import { Note } from ".prisma/client"
import { defineStore } from "pinia"
import { useAuthStore } from './auth.store'
interface State {
notes: Note[]
}
@@ -15,12 +13,8 @@ export const useNotesStore = defineStore('notes', {
},
actions: {
async fetchNotesForCurrentUser() {
const authStore = useAuthStore();
if(!authStore.activeMembership) { return; }
const { $client } = useNuxtApp();
const { notes } = await $client.notes.getForCurrentUser.query({account_id: authStore.activeMembership.account_id});
const { notes } = await $client.notes.getForCurrentUser.query();
if(notes){
this.notes = notes;
}