From 5df3c8be351901b19f853dc24f3052166ef16a69 Mon Sep 17 00:00:00 2001 From: Inga Kirschnick Date: Mon, 21 Nov 2022 14:08:49 +0100 Subject: [PATCH 1/7] bug fixes --- app/static/js/App.js | 20 +- .../SpacyNLPPipelineModelList.js | 7 +- app/static/js/Utils.js | 210 ++++++++++++++---- 3 files changed, 189 insertions(+), 48 deletions(-) diff --git a/app/static/js/App.js b/app/static/js/App.js index e20b30f2..ea8d20f7 100644 --- a/app/static/js/App.js +++ b/app/static/js/App.js @@ -16,10 +16,24 @@ class App { this.data.promises.getUser[userId] = new Promise((resolve, reject) => { fetch(`/users/${userId}?backrefs=true&relationships=true`, {headers: {Accept: 'application/json'}}) .then( - (response) => {return response.json();}, (response) => { - if (response.status === 403) {this.flash('Forbidden', 'error');} - if (response.status === 404) {this.flash('Not Found', 'error');} + switch (response.status) { + case 403: { + this.flash('Forbidden', 'error'); + break; + } + case 404: { + this.flash('Not Found', 'error'); + break; + } + default: { + response.json(); + break; + } + } + }, + (response) => { + this.flash('Something went wrong', 'error'); reject(response); } ) diff --git a/app/static/js/RessourceLists/SpacyNLPPipelineModelList.js b/app/static/js/RessourceLists/SpacyNLPPipelineModelList.js index 057e7c4c..1d7ddce4 100644 --- a/app/static/js/RessourceLists/SpacyNLPPipelineModelList.js +++ b/app/static/js/RessourceLists/SpacyNLPPipelineModelList.js @@ -31,7 +31,7 @@ class SpaCyNLPPipelineModelList extends RessourceList {
()
-
+