Commit 158baca7 authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

fixed error handling for non-existing mostRecentSetup

parent 32e97c8f
{
"name": "mc_frontend",
"version": "1.0.0",
"version": "1.0.2",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
......
......@@ -23,6 +23,8 @@ import {QueryMC} from 'src/app/models/queryMC';
import {Exercise} from 'src/app/models/exercise';
import {Feedback} from 'src/app/models/feedback';
import {PhenomenonMap} from 'src/app/models/phenomenonMap';
import {error} from 'selenium-webdriver';
import {reject} from 'q';
@Injectable({
providedIn: 'root'
......@@ -63,6 +65,7 @@ export class CorpusService {
if (HelperService.mostRecentSetup) {
this.restoreLastCorpus().then();
}
}, () => {
});
});
this.initPhenomenonMap();
......@@ -96,14 +99,16 @@ export class CorpusService {
}
checkAnnisResponse() {
return new Promise((resolve) => {
return new Promise((outerResolve, outerReject) => {
if (this.annisResponse) {
return resolve();
return outerResolve();
}
this.helperService.loadMostRecentSetup().then(() => {
this.annisResponse = HelperService.mostRecentSetup.annisResponse;
this.currentUrn = HelperService.mostRecentSetup.currentUrn;
return resolve();
return outerResolve();
}, () => {
return outerReject();
});
});
}
......
......@@ -237,10 +237,15 @@ export class HelperService {
}
loadMostRecentSetup() {
return new Promise(async (resolve) => {
return new Promise(async (resolve, reject) => {
this.storage.get(HelperService.config['localStorageKeyMostRecentSetup']).then((mrs: string) => {
if (!mrs) {
return reject();
}
HelperService.mostRecentSetup = JSON.parse(mrs);
return resolve();
}, (error: any) => {
return reject();
});
});
}
......
......@@ -9,8 +9,7 @@
<div class="toolbar-right">
<ion-spinner *ngIf="HelperService.isLoading"></ion-spinner>
<ion-select [(ngModel)]="HelperService.currentLanguage" (ngModelChange)="changeLanguage($event)"
name="currentLanguage"
placeholder="{{HelperService.currentLanguage.name}}">
name="currentLanguage" placeholder="{{HelperService.currentLanguage?.name}}">
<ion-select-option *ngFor="let lang of HelperService.languages"
value="{{lang.shortcut}}">{{lang.name}}</ion-select-option>
</ion-select>
......
......@@ -42,6 +42,7 @@ export class PreviewPage implements OnDestroy {
this.corpusService.checkAnnisResponse().then(() => {
this.processAnnisResponse(this.corpusService.annisResponse);
this.initH5P();
}, () => {
});
});
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment