Skip to content

Commit

Permalink
Merge pull request #2662 from ItzYanick/feature/registrationDisabled
Browse files Browse the repository at this point in the history
impl registrationDisabled into NavBar
  • Loading branch information
FireMasterK authored Jul 14, 2023
2 parents bf43039 + 91d1762 commit f0d7ffb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<li v-if="shouldShowLogin">
<router-link v-t="'titles.login'" to="/login" />
</li>
<li v-if="shouldShowLogin">
<li v-if="shouldShowRegister">
<router-link v-t="'titles.register'" to="/register" />
</li>
<li v-if="shouldShowHistory">
Expand Down Expand Up @@ -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();
Expand All @@ -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);
},
Expand Down Expand Up @@ -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;
});
},
},
};
</script>
Expand Down

0 comments on commit f0d7ffb

Please sign in to comment.