Authenticate the client before showing the home view home_view_auth
authorGeorgios Kontaxis <redacted>
Mon, 13 Oct 2025 18:38:36 +0000 (18:38 +0000)
committerGeorgios Kontaxis <redacted>
Mon, 13 Oct 2025 19:17:32 +0000 (19:17 +0000)
client/views/Home.vue

index 04d379696d2d60b170aad10270a4d58913a27bc3..6ae81f637354f692765ca01a3e9fff62cf6fa4c2 100644 (file)
@@ -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;
   }
git clone https://git.99rst.org/PROJECT