1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-26 03:06:25 +02:00
blog/src/stores/fetcher.ts

13 lines
303 B
TypeScript

import { type Fetcher, nanoquery } from '@nanostores/query'
export const fetcher: Fetcher<unknown> = async (
...args: any[]
): Promise<unknown> => {
const res = await fetch(args.join(''))
return await res.json()
}
export const [createFetcherStore, createMutatorStore] = nanoquery({
fetcher
})