Open History to see the last commit
1import { mutationOptions, queryOptions } from '@tanstack/lit-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 mutationKey: [...todosQueries.all(), 'create'] as const,
17 mutationFn: (title: string) => todosAPI.createTodo(title),
18 }),
19}