Добавил employee на расписание и стили

This commit is contained in:
megavrilinvv
2022-12-21 19:00:45 +03:00
parent e9a9c20fb5
commit 1fd6b62c36
6 changed files with 92 additions and 23 deletions

View File

@@ -5,6 +5,11 @@ function prepareUrl(url) {
return `https://astra-dev.dopcore.com/api/${url}`;
}
function prepareUrlApi(url) {
if (url.startsWith("http")) return url;
return `https://astra-dev.dopcore.com/${url}`;
}
function handleRequest(method, url, headers, attempts, body, type) {
return new Promise((resolve, reject) => {
(function internalRequest() {
@@ -67,12 +72,13 @@ function request(method, url, headers = {}, body, type = "") {
body: JSON.stringify(body),
};
}
return fetch(prepareUrl(url), requestOptions);
if (type === "api") {
return fetch(prepareUrlApi(url), requestOptions);
} else return fetch(prepareUrl(url), requestOptions);
}
function get(url, headers, attempts = 3) {
return handleRequest("GET", url, headers, attempts, null);
function get(url, type, headers, attempts = 3) {
return handleRequest("GET", url, headers, attempts, null, type);
}
function del(url, headers, attempts = 3) {