Files
loyaly-merchant/src/features/stores/hooks/useSites.ts

18 lines
607 B
TypeScript

'use client';
import {useResource} from '@/shared/hooks/useResource';
import {siteRepository} from '@/features/stores/repositories/siteRepository';
import type {Site} from '@/features/stores/types/site';
import type {Resource} from '@/shared/hooks/useResource';
/**
* The estate, from the platform.
*
* Unscoped on purpose — the site list is what the scope selector is FOR, so it
* cannot itself be filtered by the selection. That also means one fetch per
* session rather than one per store change.
*/
export function useSites(): Resource<Site[]> {
return useResource(siteRepository.list());
}