mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-22 05:27:20 +00:00
impl registrationDisabled into NavBar
This commit is contained in:
parent
bf43039042
commit
91d1762579
@ -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">
|
||||
@ -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;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user