diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2025-07-29 09:46:05 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2025-07-29 09:46:05 +0700 |
| commit | 077467cf53b46d8049df8b812577cd1a03011eba (patch) | |
| tree | 0dc641a9acb1237a3caca3f7f8a157a3e938c0b8 /src/core/api/biteShip.js | |
| parent | 0d28dc8ff5fb8c5399e356ed6ecae4fce2019ca6 (diff) | |
| parent | dc31efb2fec4c7b79917324d922ae820c4b5bb50 (diff) | |
<hafid> merging new release
Diffstat (limited to 'src/core/api/biteShip.js')
| -rw-r--r-- | src/core/api/biteShip.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/core/api/biteShip.js b/src/core/api/biteShip.js new file mode 100644 index 00000000..f18421d8 --- /dev/null +++ b/src/core/api/biteShip.js @@ -0,0 +1,30 @@ +import axios from 'axios'; + +const biteShipAPI = async (method, url, body = {}) => { + try { + const key = process.env.NEXT_PUBLIC_BITSEHIP_KEY; + const baseUrl = process.env.NEXT_PUBLIC_BITE_SHIP_HOST; + + const axiosParameter = { + method, + url: baseUrl + url, + headers: { + Authorization: `Bearer ${key}`, // Tambahkan "Bearer " di depan key + 'Content-Type': 'application/json', + }, + data: body, // Tidak perlu JSON.stringify + }; + + const data = await axios(axiosParameter); + + return { success: true, data: data }; + } catch (error) { + console.log(error); + return { + success: false, + data: {}, + }; + } +}; + +export default biteShipAPI; |
