project setup
This commit is contained in:
15
src/composables/useNotes.ts
Normal file
15
src/composables/useNotes.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { ref } from 'vue'
|
||||
const notes = ref<Note[]>([])
|
||||
|
||||
export default function useNotes() {
|
||||
const setDefaultNotes = (defaultNotes: Note[]) => {
|
||||
notes.value = defaultNotes.map((note) => ({
|
||||
...note,
|
||||
created: new Date().getTime(),
|
||||
modified: new Date().getTime(),
|
||||
}))
|
||||
}
|
||||
const rootNote = notes.value.find((note) => note.isRoot)
|
||||
|
||||
return { notes, setDefaultNotes, rootNote }
|
||||
}
|
||||
Reference in New Issue
Block a user