WIP Добавил обновление данных доверенных лиц

This commit is contained in:
DwCay
2023-04-28 17:47:43 +03:00
parent 58a570a102
commit adb7982605
8 changed files with 331 additions and 56 deletions

View File

@@ -41,8 +41,13 @@ function request(method, url, headers = {}, body, type = "") {
headers: {
Authorization: `Bearer ${token}`,
...headers,
"Content-Type": "application/json",
Accept: "application/json",
},
};
if (body) {
requestOptions.body = JSON.stringify(body);
}
}
if (method === "POST" || method === "PUT") {
if (type && type === "formData") {
@@ -74,8 +79,8 @@ function get(url, type, headers, attempts = 3) {
return handleRequest("GET", url, headers, attempts, null, type);
}
function del(url, headers, attempts = 3) {
return handleRequest("DELETE", url, headers, attempts, null);
function del(url, body, headers, attempts = 3) {
return handleRequest("DELETE", url, headers, attempts, body);
}
function post(url, body, type, headers, attempts = 3) {