@instockng/api-client 1.0.22 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,11 +3,9 @@
3
3
  *
4
4
  * These are the actual data-fetching functions used by hooks.
5
5
  * They can also be imported directly in Server Components.
6
- *
7
- * API URL is hardcoded to https://oms-api.instock.ng
8
6
  */
9
7
  import { createRpcClients } from '../rpc-client';
10
- const API_URL = 'https://oms-api.instock.ng';
8
+ import { API_BASE_URL } from '../provider';
11
9
  /**
12
10
  * Fetch products by brand ID
13
11
  *
@@ -15,7 +13,7 @@ const API_URL = 'https://oms-api.instock.ng';
15
13
  * @returns Products for the brand with variants and availability
16
14
  */
17
15
  export async function fetchProductsByBrand(brandId) {
18
- const clients = createRpcClients(API_URL);
16
+ const clients = createRpcClients(API_BASE_URL);
19
17
  const res = await clients.products[':brandId'].$get({
20
18
  param: { brandId },
21
19
  });
@@ -31,7 +29,7 @@ export async function fetchProductsByBrand(brandId) {
31
29
  * @returns Product with variants and availability
32
30
  */
33
31
  export async function fetchProductBySlug(slug) {
34
- const clients = createRpcClients(API_URL);
32
+ const clients = createRpcClients(API_BASE_URL);
35
33
  const res = await clients.products.product[':slug'].$get({
36
34
  param: { slug },
37
35
  });
@@ -48,7 +46,7 @@ export async function fetchProductBySlug(slug) {
48
46
  * @returns List of add-on products
49
47
  */
50
48
  export async function fetchProductAddons(slug, limit) {
51
- const clients = createRpcClients(API_URL);
49
+ const clients = createRpcClients(API_BASE_URL);
52
50
  const res = await clients.productAddons[':slug'].$get({
53
51
  param: { slug },
54
52
  query: limit !== undefined ? { limit: String(limit) } : {},