From 91d17625790a91e4e7a5dc957ad63e61a18876f9 Mon Sep 17 00:00:00 2001 From: ItzYanick Date: Fri, 14 Jul 2023 00:42:33 +0200 Subject: [PATCH] impl registrationDisabled into NavBar --- src/components/NavBar.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index 80d08fa92c..37b3b79b37 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -44,7 +44,7 @@
  • -
  • +
  • @@ -129,9 +129,11 @@ export default { suggestionsVisible: false, showTopNav: false, homePagePath: "/", + registrationDisabled: false, }; }, mounted() { + this.fetchAuthConfig(); const query = new URLSearchParams(window.location.search).get("search_query"); if (query) this.onSearchTextChange(query); this.focusOnSearchBar(); @@ -141,6 +143,9 @@ export default { shouldShowLogin(_this) { return _this.getAuthToken() == null; }, + shouldShowRegister(_this) { + return _this.registrationDisabled == false ? _this.shouldShowLogin : false; + }, shouldShowHistory(_this) { return _this.getPreferenceBoolean("watchHistory", false); }, @@ -185,6 +190,11 @@ export default { onSearchTextChange(searchText) { this.searchText = searchText; }, + async fetchAuthConfig() { + this.fetchJson(this.authApiUrl() + "/config").then(config => { + this.registrationDisabled = config?.registrationDisabled === true; + }); + }, }, };