diff --git a/src/assets/img/trash-solid.png b/src/assets/img/trash-solid.png new file mode 100644 index 0000000..167df76 Binary files /dev/null and b/src/assets/img/trash-solid.png differ diff --git a/src/components/TodoRoot.vue b/src/components/TodoRoot.vue index 97b907b..78959ef 100644 --- a/src/components/TodoRoot.vue +++ b/src/components/TodoRoot.vue @@ -6,6 +6,21 @@ --> - \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index b5c74ce..68b9954 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -5,7 +5,7 @@ * https://basebox.tech */ -import { store } from "../store"; +import {showError, store} from "../store"; import { createRouter, createWebHistory } from 'vue-router' import HomeView from '../views/HomeView.vue' import OAUthError from "../components/FatalError.vue"; @@ -47,13 +47,8 @@ router.beforeEach(async (to, from) => { } catch (err) { const errorMsg = `Failed to get session info from basebox/finish OpenID Connect login: ${err}`; console.error(errorMsg); - /* show error component */ - return { - name: "oauth-error", - params: { - errorMsg - } - } + /* show error */ + showError(errorMsg); } /* We have to create the logged-in user explicitly; see comment for `createUser()` */ @@ -62,13 +57,7 @@ router.beforeEach(async (to, from) => { } catch (err) { const errorMsg = `Failed to create user: ${err}`; console.error(errorMsg); - /* show error component */ - return { - name: "oauth-error", - params: { - errorMsg - } - } + showError(errorMsg); } return {name: 'home'}; diff --git a/src/store.js b/src/store.js index 3813642..97d1199 100644 --- a/src/store.js +++ b/src/store.js @@ -17,7 +17,7 @@ export const store = reactive({ /** basebox session data */ session: {}, - /** Fatal errort message, if any */ + /** Fatal error message, if any */ fatalError: "", }); @@ -36,5 +36,16 @@ export function clearSession() { store.session = {}; } +/** + * Show an error. + */ +export function showError(message) { + store.fatalError = message; +} - +/** + * Clear error. + */ +export function clearError() { + store.fatalError = ""; +}