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

Fix the url generation for prefixed paths (on SSR) #514

Merged
merged 1 commit into from
Feb 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
* Add initial SSR support
* It's implemented as extendable manner. Currently ReactLayout supports it.

### v2.10.1
* Fix the url generation for prefixed paths. See: [#508](https://github.com/kadirahq/flow-router/issues/508)

### v2.10.0
* Update few dependencies to the latest versions: pagejs, qs, cosmos:browserify

### v2.9.0
* Add FlowRouter.url() See: [#374](https://github.com/kadirahq/flow-router/pull/374)

Expand All @@ -83,7 +89,7 @@

### v2.6.1

* Fix [#143](https://github.com/kadirahq/flow-router/issues/314).
* Fix [#143](https://github.com/kadirahq/flow-router/issues/314).
This says that when we are doing a trigger redirect,
We won't get reactive changes like: `getRouteName()`

Expand Down Expand Up @@ -119,7 +125,7 @@
* Use pagejs.redirect() for our redirection process.
* Above fixes [#239](https://github.com/kadirahq/flow-router/issues/239)

### v2.0.0
### v2.0.0

* Released 2.0 :)
* Now flow-router comes as `kadira:flow-router`
Expand Down
11 changes: 8 additions & 3 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,14 @@ SharedRouter = class {
return new Group(this, options);
}

url() {
const path = this.path(...arguments);
return Meteor.absoluteUrl(path.replace(/^\//, ''));
url(...args) {
// We need to remove the leading base path, or "/", as it will be inserted
// automatically by `Meteor.absoluteUrl` as documented in:
// http://docs.meteor.com/#/full/meteor_absoluteurl
const completePath = this.path(...args);
const basePath = this._basePath || '/';
const pathWithoutBase = completePath.replace(RegExp(`^${basePath}`), '');
return Meteor.absoluteUrl(pathWithoutBase);
}

// For client:
Expand Down