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.subtitle = subtitle;
|
||||||
this.footer = footer;
|
this.footer = footer;
|
||||||
})
|
})
|
||||||
.catch((error) => alert(this.$advent22.format_user_error(error)));
|
.catch(this.$advent22.alert_user_error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -44,7 +44,7 @@ export default class extends Vue {
|
||||||
|
|
||||||
this.store
|
this.store
|
||||||
.login(creds)
|
.login(creds)
|
||||||
.catch((error) => alert(this.$advent22.format_user_error(error)))
|
.catch(this.$advent22.alert_user_error)
|
||||||
.finally(() => (this.is_busy = false));
|
.finally(() => (this.is_busy = false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ export default class extends Vue {
|
||||||
this.$advent22
|
this.$advent22
|
||||||
.api_get<number | null>("user/next_door")
|
.api_get<number | null>("user/next_door")
|
||||||
.then((next_door) => (this.next_door = 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) {
|
public modal_handle(modal: MultiModal) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ export default class extends Vue {
|
||||||
this.doors.push(Door.load(value));
|
this.doors.push(Door.load(value));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => alert(this.$advent22.format_user_error(error)));
|
.catch(this.$advent22.alert_user_error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -116,7 +116,7 @@ export default class extends Vue {
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
alert(this.$advent22.format_user_error(error));
|
this.$advent22.alert_user_error(error);
|
||||||
reject();
|
reject();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -134,7 +134,7 @@ export default class extends Vue {
|
||||||
.api_put("admin/doors", data)
|
.api_put("admin/doors", data)
|
||||||
.then(resolve)
|
.then(resolve)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
alert(this.$advent22.format_user_error(error));
|
this.$advent22.alert_user_error(error);
|
||||||
reject();
|
reject();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -77,6 +77,10 @@ export class Advent22 {
|
||||||
return result();
|
return result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public alert_user_error(param: [unknown, string]): void {
|
||||||
|
alert(this.format_user_error(param));
|
||||||
|
}
|
||||||
|
|
||||||
public api_url(): string;
|
public api_url(): string;
|
||||||
public api_url(endpoint: string): string;
|
public api_url(endpoint: string): string;
|
||||||
public api_url(endpoint?: string): string {
|
public api_url(endpoint?: string): string {
|
||||||
|
|
Loading…
Reference in a new issue