[WIP] Фикс запросов, добавил валидацию основных данных
This commit is contained in:
@@ -45,7 +45,7 @@ function request(method, url, headers = {}, body, type = "") {
|
||||
requestOptions.body = JSON.stringify(body);
|
||||
}
|
||||
}
|
||||
if (method === "POST" || method === "PUT") {
|
||||
if (method === "POST" || method === "PUT" || method === "PATCH") {
|
||||
if (type && type === "formData") {
|
||||
requestOptions = {
|
||||
method: method,
|
||||
@@ -83,6 +83,10 @@ function post(url, body, type, headers, attempts = 3) {
|
||||
return handleRequest("POST", url, headers, attempts, body, type);
|
||||
}
|
||||
|
||||
function patch(url, body, type, headers, attempts = 3) {
|
||||
return handleRequest("PATCH", url, headers, attempts, body, type);
|
||||
}
|
||||
|
||||
function put(url, headers, body, attempts = 3) {
|
||||
return handleRequest("PUT", url, headers, attempts, null, body);
|
||||
}
|
||||
@@ -92,4 +96,5 @@ export const fetchWrapper = {
|
||||
del,
|
||||
post,
|
||||
put,
|
||||
patch,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user