@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 an order by ID and token
13
11
  *
@@ -16,7 +14,7 @@ const API_URL = 'https://oms-api.instock.ng';
16
14
  * @returns Order with items, delivery zone, and brand
17
15
  */
18
16
  export async function fetchOrder(orderId, token) {
19
- const clients = createRpcClients(API_URL);
17
+ const clients = createRpcClients(API_BASE_URL);
20
18
  const res = await clients.orders[':id'][':token'].$get({
21
19
  param: { id: orderId, token },
22
20
  });
@@ -33,7 +31,7 @@ export async function fetchOrder(orderId, token) {
33
31
  * @returns Confirmed order
34
32
  */
35
33
  export async function confirmOrder(orderId, token) {
36
- const clients = createRpcClients(API_URL);
34
+ const clients = createRpcClients(API_BASE_URL);
37
35
  const res = await clients.orders.confirm.$post({
38
36
  json: { orderId, token },
39
37
  });
@@ -51,7 +49,7 @@ export async function confirmOrder(orderId, token) {
51
49
  * @returns Array of recommended products
52
50
  */
53
51
  export async function fetchOrderRecommendations(orderId, token, limit = 4) {
54
- const clients = createRpcClients(API_URL);
52
+ const clients = createRpcClients(API_BASE_URL);
55
53
  const res = await clients.orders[':id'][':token'].recommendations.$get({
56
54
  param: { id: orderId, token },
57
55
  // @ts-ignore - Hono RPC type inference issue with query parameters