\r
getConfig()\r
.then((data) => {\r
- globalStore.authType = data.authType;\r
- globalStore.hideRecentlyModified = data.hideRecentlyModified;\r
+ globalStore.config = data;\r
loadingIndicator.value.setLoaded();\r
})\r
.catch((error) => {\r
-import * as constants from "./constants.js";
-
import { defineStore } from "pinia";
import { ref } from "vue";
export const useGlobalStore = defineStore("global", () => {
- const authType = ref(constants.authTypes.password);
- const hideRecentlyModified = ref(true);
+ const config = ref({});
- return { authType, hideRecentlyModified };
+ return { config };
});
];\r
\r
const showNewButton = computed(() => {\r
- return globalStore.authType !== authTypes.readOnly;\r
+ return globalStore.config.authType !== authTypes.readOnly;\r
});\r
\r
function logOut() {\r
}\r
\r
function showLogOutButton() {\r
- return ![authTypes.none, authTypes.readOnly].includes(globalStore.authType);\r
+ return ![authTypes.none, authTypes.readOnly].includes(globalStore.config.authType);\r
}\r
</script>\r
const toast = useToast();
function init() {
- if (globalStore.hideRecentlyModified) {
+ if (globalStore.config.hideRecentlyModified) {
return;
}
getNotes("*", "lastModified", "desc", 5)
}
// Watch to allow for delayed config load.
-watch(() => globalStore.hideRecentlyModified, init);
+watch(() => globalStore.config.hideRecentlyModified, init);
onMounted(init);
</script>
required
/>
<TextInput
- v-if="globalStore.authType == authTypes.totp"
+ v-if="globalStore.config.authType == authTypes.totp"
v-model="totp"
id="one-time-code"
placeholder="2FA Code"
}
// Redirect to home if authentication is disabled.
-// Implemented as a watch to allow for delayed config load.
-watch(
- () => globalStore.authType,
- () => {
- if (globalStore.authType === authTypes.none) {
- router.push({ name: "home" });
- }
- },
- { immediate: true },
-);
+if (globalStore.config.authType === authTypes.none) {
+ router.push({ name: "home" });
+}
</script>
title: String,
});
-const canModify = computed(() => globalStore.authType != authTypes.readOnly);
+const canModify = computed(
+ () => globalStore.config.authType != authTypes.readOnly,
+);
let contentChangedTimeout = null;
const editMode = ref(false);
const globalStore = useGlobalStore();