Skip to content

Commit

Permalink
Only remove null and undefined query params
Browse files Browse the repository at this point in the history
Right now Ziggy is stripping query params with empty strings and zeros (falsey values). Since those can be valid query params, this change updates it to only remove null and undefined values.

Fixes #157 and #141
  • Loading branch information
reinink authored Jul 2, 2018
1 parent 32e97f8 commit b1cf161
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Router extends String {
let queryString = '?';

Object.keys(this.queryParams).forEach(function(key, i) {
if (this.queryParams[key]) {
if (this.queryParams[key] !== undefined && this.queryParams[key] !== null) {
queryString = i === 0 ? queryString : queryString + '&';
queryString += key + '=' + encodeURIComponent(this.queryParams[key]);
}
Expand Down

0 comments on commit b1cf161

Please sign in to comment.