mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
add and use $advent22.alert_user_error
This commit is contained in:
parent
8e4ea78873
commit
dae862fc55
6 changed files with 10 additions and 6 deletions
|
@ -64,7 +64,7 @@ export default class extends Vue {
|
|||
this.subtitle = subtitle;
|
||||
this.footer = footer;
|
||||
})
|
||||
.catch((error) => alert(this.$advent22.format_user_error(error)));
|
||||
.catch(this.$advent22.alert_user_error);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -44,7 +44,7 @@ export default class extends Vue {
|
|||
|
||||
this.store
|
||||
.login(creds)
|
||||
.catch((error) => alert(this.$advent22.format_user_error(error)))
|
||||
.catch(this.$advent22.alert_user_error)
|
||||
.finally(() => (this.is_busy = false));
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ export default class extends Vue {
|
|||
this.$advent22
|
||||
.api_get<number | null>("user/next_door")
|
||||
.then((next_door) => (this.next_door = next_door))
|
||||
.catch((error) => alert(this.$advent22.format_user_error(error)));
|
||||
.catch(this.$advent22.alert_user_error);
|
||||
}
|
||||
|
||||
public modal_handle(modal: MultiModal) {
|
||||
|
|
|
@ -27,7 +27,7 @@ export default class extends Vue {
|
|||
this.doors.push(Door.load(value));
|
||||
}
|
||||
})
|
||||
.catch((error) => alert(this.$advent22.format_user_error(error)));
|
||||
.catch(this.$advent22.alert_user_error);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -116,7 +116,7 @@ export default class extends Vue {
|
|||
resolve();
|
||||
})
|
||||
.catch((error) => {
|
||||
alert(this.$advent22.format_user_error(error));
|
||||
this.$advent22.alert_user_error(error);
|
||||
reject();
|
||||
});
|
||||
});
|
||||
|
@ -134,7 +134,7 @@ export default class extends Vue {
|
|||
.api_put("admin/doors", data)
|
||||
.then(resolve)
|
||||
.catch((error) => {
|
||||
alert(this.$advent22.format_user_error(error));
|
||||
this.$advent22.alert_user_error(error);
|
||||
reject();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -77,6 +77,10 @@ export class Advent22 {
|
|||
return result();
|
||||
}
|
||||
|
||||
public alert_user_error(param: [unknown, string]): void {
|
||||
alert(this.format_user_error(param));
|
||||
}
|
||||
|
||||
public api_url(): string;
|
||||
public api_url(endpoint: string): string;
|
||||
public api_url(endpoint?: string): string {
|
||||
|
|
Loading…
Reference in a new issue