diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-11 09:47:25 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-11 09:47:25 +0700 |
| commit | 92c2a229d9c9b510d71b928978872a8b107e9d5a (patch) | |
| tree | 8d8161a49a0bdc46d4c28d3f2682bb485314a41d /src/core/api | |
| parent | 62bebc1d33fd090d7666e18e7a0326ef7ef36897 (diff) | |
Documentation and refactor code
Diffstat (limited to 'src/core/api')
| -rw-r--r-- | src/core/api/odooApi.js | 11 |
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 { |
