From 4e66d304e5768cb68870db9677f8f8dd8d8f5e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Sat, 11 Nov 2023 02:07:42 +0000 Subject: [PATCH] Advent22.alert_user_error: Use bulma-toast --- ui/src/components/Calendar.vue | 2 +- ui/src/components/admin/DoorMapEditor.vue | 5 +++-- ui/src/plugins/advent22.ts | 6 +++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ui/src/components/Calendar.vue b/ui/src/components/Calendar.vue index 5f074bf..0590ffb 100644 --- a/ui/src/components/Calendar.vue +++ b/ui/src/components/Calendar.vue @@ -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(); }); } diff --git a/ui/src/components/admin/DoorMapEditor.vue b/ui/src/components/admin/DoorMapEditor.vue index b8e0ba6..f1f21ce 100644 --- a/ui/src/components/admin/DoorMapEditor.vue +++ b/ui/src/components/admin/DoorMapEditor.vue @@ -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)); }) diff --git a/ui/src/plugins/advent22.ts b/ui/src/plugins/advent22.ts index a3aba49..55f53cf 100644 --- a/ui/src/plugins/advent22.ts +++ b/ui/src/plugins/advent22.ts @@ -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;