From: Georgios Kontaxis Date: Mon, 13 Oct 2025 18:38:36 +0000 (+0000) Subject: Authenticate the client before showing the home view X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=refs%2Fheads%2Fhome_view_auth;p=flatnotes.git Authenticate the client before showing the home view --- diff --git a/client/views/Home.vue b/client/views/Home.vue index 04d3796..6ae81f6 100644 --- a/client/views/Home.vue +++ b/client/views/Home.vue @@ -44,11 +44,11 @@ import { useToast } from "primevue/usetoast"; import { onMounted, ref, watch } from "vue"; import { RouterLink } from "vue-router"; -import { apiErrorHandler, getNotes } from "../api.js"; +import { apiErrorHandler, getNotes, getTags } from "../api.js"; import CustomButton from "../components/CustomButton.vue"; import LoadingIndicator from "../components/LoadingIndicator.vue"; import Logo from "../components/Logo.vue"; -import { searchSortOptions } from "../constants.js"; +import { searchSortOptions, authTypes } from "../constants.js"; import { useGlobalStore } from "../globalStore.js"; import SearchInput from "../partials/SearchInput.vue"; @@ -58,6 +58,13 @@ const notes = ref([]); const toast = useToast(); function init() { + // Should the user authenticate before accessing the home view? + // Try an authenticated request and prompt for a login if needed. + if (![authTypes.none, authTypes.readOnly].includes(globalStore.config.authType)) { + getTags().catch((error) => { + apiErrorHandler(error, toast); + }); + } if (globalStore.config.quickAccessHide) { return; }