summaryrefslogtreecommitdiff
path: root/src/lib/checkout/api/getRatesCourier.js
blob: 0108a3b8966224212be7351ef862d553d7ed3263 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import axios from 'axios';
import biteShipAPI from '../../../core/api/biteShip';

const GetRatesCourierBiteship = async ({ destination, items }) => {
  const couriers = process.env.NEXT_PUBLIC_BITESHIP_CODE_COURIERS;
  let body = {
    ...destination,
    couriers: couriers,
    items: items,
  };

  const response = await axios(
    `${process.env.NEXT_PUBLIC_SELF_HOST}/api/biteship-service?method=POST&url=/v1/rates/couriers&body=` +
      JSON.stringify(body)
  );

  // const featch = await biteShipAPI('POST', '/v1/rates/couriers', body);
  // console.log('ini featch', response);

  return response;
};

export default GetRatesCourierBiteship;