Skip to content

Commit

Permalink
make loadAnnotationTypeList async
Browse files Browse the repository at this point in the history
  • Loading branch information
timonegk committed Mar 30, 2021
1 parent e5fbb8f commit 18276b4
Showing 1 changed file with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,18 +249,17 @@ function calculateImageScale() {
}
}

function loadAnnotationTypeList() {
$.ajax(API_ANNOTATIONS_BASE_URL + 'annotation/loadannotationtypes/', {
type: 'GET',
headers: gHeaders,
dataType: 'json',
success: function (data) {
displayAnnotationTypeOptions(data.annotation_types);
},
error: function () {
displayFeedback($('#feedback_connection_error'))
}
})
async function loadAnnotationTypeList() {
try {
let response = await fetch(API_ANNOTATIONS_BASE_URL + 'annotation/loadannotationtypes/', {
method: 'GET',
headers: gHeaders,
});
let data = await response.json();
displayAnnotationTypeOptions(data.annotation_types);
} catch {
displayFeedback($('#feedback_connection_error'))
}
}

function displayAnnotationTypeOptions(annotationTypeList) {
Expand Down

0 comments on commit 18276b4

Please sign in to comment.