summaryrefslogtreecommitdiff
path: root/src/clients/loaders.ts
blob: 43c15812f6b296f95f044a470582e86e5cb49ea9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { ApiClient } from "./api_client";

export async function loader({ request }) {
  const client = new ApiClient();
  const url = new URL(request.url)
  const response = await client.get(url.pathname);
  
  return response;
}

export async function productLoader({ params }) {
  const client = new ApiClient();
  const response = await client.getProduct(params.productId);
  
  return [response[0], response[1]];
}