From 9079fca30fd214a83d5703d22cc898be2c6a3fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Fri, 5 Dec 2025 02:30:58 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20minor=20bugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - use empty credentials when none given - fix FontAwesomeIcon --- ui/src/lib/api.ts | 19 +++++++++++-------- ui/src/{plugins => lib}/fontawesome.ts | 12 +++--------- ui/src/main.ts | 8 ++++---- 3 files changed, 18 insertions(+), 21 deletions(-) rename ui/src/{plugins => lib}/fontawesome.ts (70%) diff --git a/ui/src/lib/api.ts b/ui/src/lib/api.ts index a9c335a..3ab2270 100644 --- a/ui/src/lib/api.ts +++ b/ui/src/lib/api.ts @@ -33,20 +33,23 @@ export class API { baseURL: this.api_baseurl, }); - private static readonly storage_key = "advent22/credentials"; + private static readonly creds_key = "advent22/credentials"; public static set creds(value: AxiosBasicCredentials | null) { if (value === null) { - localStorage.removeItem(this.storage_key); - return; + localStorage.removeItem(this.creds_key); + } else { + localStorage.setItem(this.creds_key, JSON.stringify(value)); } - - localStorage.setItem(this.storage_key, JSON.stringify(value)); } - public static get creds(): AxiosBasicCredentials | undefined { - const auth_json = localStorage.getItem(this.storage_key); - if (auth_json !== null) return JSON.parse(auth_json); + public static get creds(): AxiosBasicCredentials { + const auth_json = localStorage.getItem(this.creds_key); + if (auth_json !== null) { + return JSON.parse(auth_json); + } else { + return { username: "", password: "" }; + } } private static get_axios_config({ diff --git a/ui/src/plugins/fontawesome.ts b/ui/src/lib/fontawesome.ts similarity index 70% rename from ui/src/plugins/fontawesome.ts rename to ui/src/lib/fontawesome.ts index b3a37e6..87d8835 100644 --- a/ui/src/plugins/fontawesome.ts +++ b/ui/src/lib/fontawesome.ts @@ -1,4 +1,5 @@ -import { App, Plugin } from "vue"; +/* import font awesome icon component */ +import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; /* import the fontawesome core */ import { library } from "@fortawesome/fontawesome-svg-core"; @@ -10,11 +11,4 @@ import { fas } from "@fortawesome/free-solid-svg-icons"; /* add icons to the library */ library.add(fas); -/* import font awesome icon component */ -import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; - -export const FontAwesomePlugin: Plugin = { - install(app: App) { - app.component("font-awesome-icon", FontAwesomeIcon); - }, -}; +export default FontAwesomeIcon; diff --git a/ui/src/main.ts b/ui/src/main.ts index 89115e0..bc4d049 100644 --- a/ui/src/main.ts +++ b/ui/src/main.ts @@ -1,6 +1,6 @@ +import FontAwesomeIcon from "@/lib/fontawesome"; import { advent22Store } from "@/lib/store"; -import { FontAwesomePlugin } from "@/plugins/fontawesome"; -import * as bulmaToast from "bulma-toast"; +import { setDefaults as toast_set_defaults } from "bulma-toast"; import { createPinia } from "pinia"; import { createApp } from "vue"; import App from "./App.vue"; @@ -9,14 +9,14 @@ import "@/main.scss"; const app = createApp(App); -app.use(FontAwesomePlugin); app.use(createPinia()); +app.component("FontAwesomeIcon", FontAwesomeIcon); advent22Store().init(); app.mount("#app"); -bulmaToast.setDefaults({ +toast_set_defaults({ duration: 10e3, pauseOnHover: true, dismissible: true,