summaryrefslogtreecommitdiff
path: root/src/clients/loaders.ts
blob: 334f8aa8a6f3d0ccbfc3049d28c03d5d68226f47 (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}${url.search}`);
  
  return response;
}

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