diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2025-06-16 02:05:40 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2025-06-16 02:05:40 +0000 |
| commit | 755163a9f803e6959afb4568baa55538b9628cab (patch) | |
| tree | 4469b0d7c6e8b2a7185b271d9589e8de4724d4f2 /src/core/api/biteShip.js | |
| parent | 5669295b8cff1a9c9e559dd263599123a2ad6e92 (diff) | |
| parent | 8ca6c0aa1b2a578332ff1c3706f58530f549352e (diff) | |
Merged in biteship-merge (pull request #420)
Biteship merge
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; |
