Files
afrobiz/stores/notes.store.ts
2023-04-12 00:05:32 +10:00

24 lines
462 B
TypeScript

import { Note } from ".prisma/client"
import { defineStore } from "pinia"
interface State {
notes: Note[]
}
export const useNotesStore = defineStore('notes', {
state: (): State => {
return {
notes: [],
}
},
actions: {
async fetchNotesForCurrentUser() {
const { $client } = useNuxtApp();
const { notes } = await $client.notes.getForCurrentUser.query();
if(notes){
this.notes = notes;
}
},
}
});