kremalicious/blog

View on GitHub
src/stores/location.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { createFetcherStore } from './fetcher'

export type Location = {
  country: string
  city: string
  country_code: string
  date_start: string
  date_end: string
}

export type LocationStore =
  | {
      now: Location
      next: Location
      previous: Location
    }
  | undefined

const url = 'https://location.kremalicious.com'

export const $location = createFetcherStore<LocationStore>([url], {
  revalidateOnReconnect: true,
  revalidateOnFocus: true
})