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: allow redirect to external url #2265

Merged
merged 2 commits into from Nov 28, 2017

Conversation

Projects
None yet
5 participants
@clarkdo
Copy link
Member

clarkdo commented Nov 28, 2017

Resolve #770 #2287, refactor #2055

  • add formatUrl method to format url with query object
  • allow redirect to external link, such as:
    1. redirect('github.com/nuxt/nuxt.js')
    2. redirect('https://example.com/api/data?query=test', {query2: 'test2'})
  • add test

@clarkdo clarkdo requested review from Atinux and pi0 Nov 28, 2017

@clarkdo clarkdo force-pushed the clarkdo:external_url branch 2 times, most recently Nov 28, 2017

clarkdo added some commits Nov 28, 2017

@clarkdo clarkdo force-pushed the clarkdo:external_url branch to 3020af7 Nov 28, 2017

@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Nov 28, 2017

Codecov Report

Merging #2265 into dev will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##              dev    #2265   +/-   ##
=======================================
  Coverage   98.36%   98.36%           
=======================================
  Files          15       15           
  Lines         977      977           
=======================================
  Hits          961      961           
  Misses         16       16

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0558ae2...3020af7. Read the comment docs.

@Atinux Atinux merged commit 887ebd5 into nuxt:dev Nov 28, 2017

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
security/snyk No new issues
Details
@pi0
Copy link
Member

pi0 left a comment

.

query: query,
status: status
})
if (path.charAt(0) === '/' && path.charAt(1) !== '/') {

This comment has been minimized.

@pi0

pi0 Nov 28, 2017

Member

Does this means we don't support relative URLs anymore? Something like ./comments will be an external URL :)

This comment has been minimized.

@clarkdo

clarkdo Nov 28, 2017

Member

@pi0 Yes, I just read the vue-router sources, I will make a change.

@@ -7,6 +7,9 @@ export default {
name: 'nuxt',
props: ['nuxtChildKey'],
render(h) {
if (this.nuxt._redirected) {
return h('div', [ 'redirecting.' ])

This comment has been minimized.

@pi0

pi0 Nov 28, 2017

Member

Maybe we can support for i18n of this message :) I will handle it

This comment has been minimized.

@clarkdo

clarkdo Nov 28, 2017

Member

What about of moving it to options.messages ? If ok, I will open a pr 😄

This comment has been minimized.

@pi0

pi0 Nov 28, 2017

Member

If you can do it it would be awesome 😍

app.nuxt._redirected = true
}
if (process.client) {
window.location = path

This comment has been minimized.

@ydnar

ydnar Jan 16, 2018

This should be window.location.replace(path). The current form adds an additional history item.

Reproduce by clicking a redirect link, then hit Back twice. It should go back after one click.

This comment has been minimized.

@pi0

pi0 Jan 16, 2018

Member

Already fixed in dev branch :)

This comment has been minimized.

@Atinux

Atinux Jan 17, 2018

Member

Thank you @ydnar

This comment has been minimized.

@ydnar
@lock

This comment has been minimized.

Copy link

lock bot commented Nov 1, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 1, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.