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

feat: use nuxt's base url setting #1023

Merged
merged 1 commit into from
Jan 24, 2021
Merged

feat: use nuxt's base url setting #1023

merged 1 commit into from
Jan 24, 2021

Conversation

JoaoPedroAS51
Copy link
Collaborator

@JoaoPedroAS51 JoaoPedroAS51 commented Jan 23, 2021

I opened a new PR due to conflicts, as #489 is outdated.

// cc @NickBolles

There are 3 main changes here

  1. Update insidePage to take the context
  2. Update isSameURL to take the context
  3. Update normalizePath to take the context
  4. For each of those if the context is passed in, replace the base path in the path we are checking with "/"
  5. In oath2.js and middleware.js pass in context to these functions to allow the checks to succeed correctly.

The only real issue with this (If i remember correctly) was that the callback path for OAUTH2 was not using the base path. But once we start using the base path it would also throw off the checking to see if this is the same route or not

Fixes #275, fixes #879
Closes #489

@bmulholland bmulholland merged commit c71a9a1 into dev Jan 24, 2021
@bmulholland bmulholland deleted the feat/nuxt-base-url branch January 24, 2021 11:01
// Remove query string
let result = path.split('?')[0]

// Remove base path
if (ctx && ctx.base) {
Copy link
Member

Choose a reason for hiding this comment

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

I would split this out of normalizePath into a utility like withoutBase(path, base). Also would be nice at some point we migrate to ufo since it is standard library we started using in several places

Copy link
Collaborator Author

@JoaoPedroAS51 JoaoPedroAS51 Jan 24, 2021

Choose a reason for hiding this comment

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

I think I'll let this migration with you, as you are the author of ufo and I've not used it yet.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, good idea! I agree about splitting into withoutBase. But should I do it tomorrow or wait for ufo migration?

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.

auth0 redirect not working when using a non default router.base 'redirect callback' ignores 'router base'
4 participants