Advent22.alert_user_error: Use bulma-toast

This commit is contained in:
Jörn-Michael Miehe 2023-11-11 02:07:42 +00:00
parent 785c74fd7b
commit 4e66d304e5
3 changed files with 9 additions and 4 deletions

View file

@ -107,7 +107,7 @@ export default class extends Vue {
this.multi_modal!.show_image(image_src, this.$advent22.name_door(day));
})
.catch((error) => {
alert(error);
this.$advent22.alert_user_error(error);
this.multi_modal!.hide();
});
}

View file

@ -73,6 +73,7 @@ import { DoorSaved } from "@/lib/api";
import { Door } from "@/lib/door";
import { Options, Vue } from "vue-class-component";
import { toast } from "bulma-toast";
import Calendar from "../Calendar.vue";
import BulmaBreadcrumbs, { Step } from "../bulma/Breadcrumbs.vue";
import BulmaButton from "../bulma/Button.vue";
@ -149,7 +150,7 @@ export default class extends Vue {
this.loading_doors = true;
this.load_doors()
.then(() => alert("Erfolgreich!"))
.then(() => toast({ message: "Erfolgreich!", type: "is-success" }))
.catch(() => {})
.finally(() => (this.loading_doors = false));
}
@ -169,7 +170,7 @@ export default class extends Vue {
this.save_doors()
.then(() => {
this.load_doors()
.then(() => alert("Erfolgreich!"))
.then(() => toast({ message: "Erfolgreich!", type: "is-success" }))
.catch(() => {})
.finally(() => (this.saving_doors = false));
})

View file

@ -1,4 +1,5 @@
import axios, { AxiosError, AxiosInstance, ResponseType } from "axios";
import { toast } from "bulma-toast";
import { App, Plugin } from "vue";
import { advent22Store } from "./store";
@ -78,7 +79,10 @@ export class Advent22 {
}
public alert_user_error(param: [unknown, string]): void {
alert(this.format_user_error(param));
toast({
message: this.format_user_error(param),
type: "is-danger",
});
}
public api_url(): string;