blob: adc9d44e926f95f8e8119300fbd47185d5034ccd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import { apiClient } from "../api/client";
import { createReloadableAtom } from "./utils";
export interface NoteType {
id: string;
name: string;
frontTemplate: string;
backTemplate: string;
isReversible: boolean;
createdAt: string;
updatedAt: string;
}
// =====================
// NoteTypes List - Suspense-compatible
// =====================
export const noteTypesAtom = createReloadableAtom(async () => {
const res = await apiClient.rpc.api["note-types"].$get();
const data = await apiClient.handleResponse<{ noteTypes: NoteType[] }>(res);
return data.noteTypes;
});
|