Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl registrationDisabled into NavBar #2662

Merged
merged 1 commit into from
Jul 14, 2023
Merged

impl registrationDisabled into NavBar #2662

merged 1 commit into from
Jul 14, 2023

Conversation

ItzYanick
Copy link
Contributor

The "Register" button will now only show when it is enabled on the server.
Because of the async delay when fetching the configuration from the server, it will show the "Register" button for a short period of time until the data is loaded.

Side Note

Servers without the newest version (TeamPiped/Piped-Backend#645) will still show the button.

Copy link
Member

@FireMasterK FireMasterK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

@FireMasterK FireMasterK merged commit f0d7ffb into TeamPiped:master Jul 14, 2023
@@ -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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like this because the config will now be fetched twice on each lagd reload, since the footer component does the same in order to receive the URLs in the footer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me too, but I thought this was okay since we're fetching the configuration of the authentication API. We need to make a universal way of loading it for the oidc PR too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was also thinking of loading the config and caching it somewhere so it does not have to be loaded twice if authApi = api but i thought this might be out-of-scope for this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants