Add config to disable registration

This commit is contained in:
2026-02-24 00:00:35 +01:00
parent 67b305786b
commit 00a5a6c045
7 changed files with 72 additions and 1 deletions

View File

@@ -4,6 +4,8 @@
import NavBarSearch from './NavBarSearch.vue'
import BarcodeModal from './BarcodeModal.vue'
import { useAuthStore } from './auth.store.js'
import { getAppInfo } from './api.js'
import { onMounted } from 'vue'
const authStore = useAuthStore();
const router = useRouter();
@@ -16,6 +18,12 @@
router.push('/');
}
const appInfo = ref(null);
const appInfoErr = ref(null);
onMounted(() => {
getAppInfo(appInfo, appInfoErr);
})
</script>
<template>
@@ -74,7 +82,7 @@
</div>
<div v-else class="navbar-item">
<div class="buttons">
<RouterLink to="/signup" class="button is-primary">
<RouterLink v-if="appInfo && !appInfo.registrationDisabled" to="/signup" class="button is-primary">
<strong>{{ $t('navbar.signup')}}</strong>
</RouterLink>
<RouterLink to="/login" class="button is-light">

View File

@@ -34,6 +34,14 @@ function useFetch(data, error, url) {
}
}
export function getAppInfo(appInfo, appInfoErr) {
fetch('/ws/appinfo', {
method: 'GET'
}).then((res) => res.json())
.then((json) => appInfo.value = json)
.catch((err) => (appInfoErr.value = err))
}
export function getMyBooks(data, error, arg, limit, offset) {
const queryParams = new URLSearchParams({limit: limit, offset: offset});
return useFetch(data, error, '/ws/mybooks/' + arg + "?" + queryParams.toString());