Fehlermeldungen hinzugefügt, wenn Verbindung zur API nicht klappt
This commit is contained in:
@@ -50,6 +50,13 @@ class RitzenbergenLib {
|
||||
return apiBaseUrl + path;
|
||||
else return apiBaseUrl+"/" + path;
|
||||
}
|
||||
static async checkInternetConnection(): Promise<boolean> {
|
||||
try{
|
||||
return await fetch(this.api("/addhit.php")).then((response)=>response.ok);
|
||||
} catch(e){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Paarung {
|
||||
@@ -171,6 +178,7 @@ class Formular {
|
||||
}
|
||||
public static async getForms(): Promise<Formular[]> {
|
||||
let forms: Formular[] = [];
|
||||
try{
|
||||
forms = await fetch(
|
||||
RitzenbergenLib.api("/formulare/get_formulare.php"),
|
||||
{
|
||||
@@ -191,6 +199,9 @@ class Formular {
|
||||
)
|
||||
);
|
||||
|
||||
} catch(e){
|
||||
console.warn(e);
|
||||
}
|
||||
return forms;
|
||||
}
|
||||
private async getFields(): Promise<Field[]> {
|
||||
|
||||
Reference in New Issue
Block a user