rename previous hook

This commit is contained in:
Julien Calixte
2023-08-13 21:10:21 +02:00
parent 1b7f7539a8
commit 133a998ef8
3 changed files with 2 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
import { data } from '@/data/data'
import { DataType } from '@/data/DataType.enum'
import { Note } from '@/modules/note/models/Note'
export const prepareNoteCache = (sha: string) => {
const noteId = data.generateId(DataType.Note, sha)
const getCachedNote = async () => data.get<DataType.Note, Note>(noteId)
const saveCacheNote = async (content: string) => {
const newNote: Note = {
_id: noteId,
$type: DataType.Note,
content
}
await data.update(newNote)
}
return {
getCachedNote,
saveCacheNote
}
}