UNPKG

@thunderstorefront/sdk

Version:

Create Nuxt extendable layer with this GitHub template.

16 lines (11 loc) 388 B
import type { Route } from '@thunderstorefront/types'; export interface UseStoreRouteApi<TRoute = Route> { fetchRoute: (route: string) => Promise<TRoute>; } export function useStoreRouteApi(): UseStoreRouteApi { const client = useClient(); async function fetchRoute(route: string): Promise<Route> { return await client(`/api/route/${route}`); } return { fetchRoute }; }