Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ФТ-202 Южанин Арсений Иванов Станислав #115

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions static/focus.js
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ const API = {
buhForms: "/api3/buh",
};


async function run() {
const orgOgrns = await sendRequest(API.organizationList);
const ogrns = orgOgrns.join(",");
@@ -28,19 +29,19 @@ async function run() {
}

function sendRequest(url) {
return new Promise((resolve) => {
return new Promise((resolve, reject) => {
fetch(url)
.then(response => {
if (!response.ok) {
throw new Error(`Status error ${response.status} and url ${response.url}`);
throw new Error(`Request failed with status ${response.status}`);
}
return response.json();
})
.then(data => {
resolve(data);
})
.catch(error => {
alert(error.message);
reject(new Error("Request failed: " + error.message));
});
});
}
@@ -94,7 +95,7 @@ function renderOrganization(orgInfo, template, container) {
orgInfo.buhForms[orgInfo.buhForms.length - 1].form2[0] &&
orgInfo.buhForms[orgInfo.buhForms.length - 1].form2[0]
.endValue) ||
0
0
);
} else {
money.textContent = "—";