Open History to see the last commit
1import { mutationOptions, queryOptions } from '@tanstack/solid-query'
2import { todosAPI } from './api'
3β
4export const todosQueries = {
5 all: () => ['todos'] as const,
6 list: () =>
7 queryOptions({
8 queryKey: [...todosQueries.all(), 'list'] as const,
9 queryFn: () => todosAPI.getTodos(),
10 }),
11}
12β
13export const todosMutations = {
14 create: () =>
15 mutationOptions({
16 mutationFn: (text: string) => todosAPI.createTodo(text),
17 }),
18}