summaryrefslogtreecommitdiff
path: root/src/core/api
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-04-11 11:06:38 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-04-11 11:06:38 +0700
commit3df233e0c23e7d4503931ab6ec8ffc41642ac104 (patch)
treeccc032defe422f5fafc4a08af672833b2fe41835 /src/core/api
parent006c77a85786c24199db157d1d70f48b47311d35 (diff)
parentf0a720441def88187b3913268238c379362fb9d3 (diff)
Merge branch 'master' into development_tri/feedback_UAT
Diffstat (limited to 'src/core/api')
-rw-r--r--src/core/api/odooApi.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/api/odooApi.js b/src/core/api/odooApi.js
index 25ee9adf..fe9fcdd2 100644
--- a/src/core/api/odooApi.js
+++ b/src/core/api/odooApi.js
@@ -18,6 +18,17 @@ const getToken = async () => {
const maxConnectionAttempt = 15
let connectionAttempt = 0
+/**
+ * The `odooApi` function is used to make API requests to an Odoo backend with customizable parameters such as `method`, `url`, `data`, and `headers`.
+ *
+ * @async
+ * @function
+ * @param {string} method - HTTP method for the API request (e.g., GET, POST, PUT, DELETE).
+ * @param {string} url - URL endpoint for the API request.
+ * @param {Object} data - Data to be sent in the request payload.
+ * @param {Object} headers - Custom headers to be sent in the request.
+ * @returns {Promise} - A Promise that resolves to the API response data or an empty array.
+ */
const odooApi = async (method, url, data = {}, headers = {}) => {
connectionAttempt++
try {