🐛 minor bugs

- use empty credentials when none given
- fix FontAwesomeIcon
This commit is contained in:
Jörn-Michael Miehe 2025-12-05 02:30:58 +00:00
parent 029b361e2d
commit 9079fca30f
3 changed files with 18 additions and 21 deletions

View file

@ -33,20 +33,23 @@ export class API {
baseURL: this.api_baseurl, 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) { public static set creds(value: AxiosBasicCredentials | null) {
if (value === null) { if (value === null) {
localStorage.removeItem(this.storage_key); localStorage.removeItem(this.creds_key);
return; } else {
localStorage.setItem(this.creds_key, JSON.stringify(value));
}
} }
localStorage.setItem(this.storage_key, JSON.stringify(value)); 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: "" };
} }
public static get creds(): AxiosBasicCredentials | undefined {
const auth_json = localStorage.getItem(this.storage_key);
if (auth_json !== null) return JSON.parse(auth_json);
} }
private static get_axios_config({ private static get_axios_config({

View file

@ -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 the fontawesome core */
import { library } from "@fortawesome/fontawesome-svg-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 */ /* add icons to the library */
library.add(fas); library.add(fas);
/* import font awesome icon component */ export default FontAwesomeIcon;
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
export const FontAwesomePlugin: Plugin = {
install(app: App) {
app.component("font-awesome-icon", FontAwesomeIcon);
},
};

View file

@ -1,6 +1,6 @@
import FontAwesomeIcon from "@/lib/fontawesome";
import { advent22Store } from "@/lib/store"; import { advent22Store } from "@/lib/store";
import { FontAwesomePlugin } from "@/plugins/fontawesome"; import { setDefaults as toast_set_defaults } from "bulma-toast";
import * as bulmaToast from "bulma-toast";
import { createPinia } from "pinia"; import { createPinia } from "pinia";
import { createApp } from "vue"; import { createApp } from "vue";
import App from "./App.vue"; import App from "./App.vue";
@ -9,14 +9,14 @@ import "@/main.scss";
const app = createApp(App); const app = createApp(App);
app.use(FontAwesomePlugin);
app.use(createPinia()); app.use(createPinia());
app.component("FontAwesomeIcon", FontAwesomeIcon);
advent22Store().init(); advent22Store().init();
app.mount("#app"); app.mount("#app");
bulmaToast.setDefaults({ toast_set_defaults({
duration: 10e3, duration: 10e3,
pauseOnHover: true, pauseOnHover: true,
dismissible: true, dismissible: true,