|
|
|
@ -29,6 +29,23 @@ const submitNote = async (note: unknown, noteId: string | string[]) => {
|
|
|
|
return response
|
|
|
|
return response
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const deleteNote = async (noteId: string | string[]) => {
|
|
|
|
|
|
|
|
let response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await useFetch('/api/note', {
|
|
|
|
|
|
|
|
method: 'DELETE',
|
|
|
|
|
|
|
|
query: {
|
|
|
|
|
|
|
|
id: noteId,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onResponse({ response }) {
|
|
|
|
|
|
|
|
console.log('DELETE:', response._data.message)
|
|
|
|
|
|
|
|
response = response._data
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return response
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type Note = z.infer<typeof noteSchema>
|
|
|
|
type Note = z.infer<typeof noteSchema>
|
|
|
|
|
|
|
|
|
|
|
|
const useNote = () =>
|
|
|
|
const useNote = () =>
|
|
|
|
@ -36,4 +53,4 @@ const useNote = () =>
|
|
|
|
|
|
|
|
|
|
|
|
const useDescription = () => useState<string>('description', () => '')
|
|
|
|
const useDescription = () => useState<string>('description', () => '')
|
|
|
|
|
|
|
|
|
|
|
|
export { submitNote, useNote, useDescription }
|
|
|
|
export { deleteNote, submitNote, useDescription, useNote }
|
|
|
|
|