Skip to content

Commit e1d7b52

Browse files
committed
recheck buttons
1 parent b8d2906 commit e1d7b52

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

app/static/js/utils.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@ function buildTitleRow(columns) {
99
}
1010

1111
function recheck(trainingId){
12-
console.log(`Start recheck for ${trainingId}`)
13-
fetch(`/api/trainings/${trainingId}/`, {method: "POST"})
12+
fetch('/api/sessions/admin')
1413
.then(response => response.json())
15-
.then(innerResponseJson => {
16-
if (innerResponseJson["message"] === "OK") {
17-
window.open(`/trainings/statistics/${trainingId}/`);
18-
//location.href = `/trainings/statistics/${trainingId}/`;
14+
.then(res => {
15+
if (res.admin) {
16+
fetch(`/api/trainings/${trainingId}/`, {method: "POST"})
17+
.then(response => response.json())
18+
.then(innerResponseJson => {
19+
if (innerResponseJson["message"] === "OK") {
20+
window.open(`/trainings/statistics/${trainingId}/`);
21+
//location.href = `/trainings/statistics/${trainingId}/`;
22+
}
23+
});
1924
}
2025
});
2126
}

0 commit comments

Comments
 (0)