This commit is contained in:
Ren Amamiya
2023-03-24 14:59:01 +07:00
parent e2fa8cbe03
commit c1f06f8b28
29 changed files with 179 additions and 229 deletions

View File

@@ -1,6 +1,15 @@
import { getAllNotes } from '@utils/storage';
import { atom } from 'jotai';
import { atomsWithQuery } from 'jotai-tanstack-query';
// usecase: notify user that connector has receive newer note
export const hasNewerNoteAtom = atom(false);
// usecase: query notes from database
export const notesAtom = atom([]);
export const [notesAtom] = atomsWithQuery(() => ({
queryKey: ['notes'],
queryFn: async ({ queryKey: [] }) => {
const res = await getAllNotes();
return res;
},
}));