kremalicious/blog

View on GitHub
src/stores/fetcher.ts

Summary

Maintainability
A
0 mins
Test Coverage
F
50%
import { type Fetcher, nanoquery } from '@nanostores/query'

export const fetcher: Fetcher<unknown> = async (
  ...args: unknown[]
): Promise<unknown> => {
  const res = await fetch(args.join(''))
  return await res.json()
}

export const [createFetcherStore, createMutatorStore] = nanoquery({
  fetcher
})