Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

api.ts

9 lines274 Bytes

1export const todosAPI = {
2 getTodos: (): Promise<Array<string>> => $fetch('/api/data'),
3 createTodo: async (add: string) => {
4 await $fetch('/api/data', { query: { add } })
5 },
6 deleteTodos: async () => {
7 await $fetch('/api/data', { query: { clear: 1 } })
8 },
9}