]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
feat: push entry to history
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 16 Apr 2019 14:58:36 +0000 (16:58 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 16 Apr 2019 14:58:36 +0000 (16:58 +0200)
src/history/html5.ts
src/history/utils.ts
src/router.ts

index 6871484a9f55eb318e26ffc542b4d1c1cf641fc6..e19d3fdbe2f35de61daaf5a668d8efd4161554eb 100644 (file)
@@ -79,7 +79,7 @@ export class HTML5History extends BaseHistory {
       ...buildState(this.location, normalized, null),
       ...data,
     }
-    cs.info('push', this.location, '->', to, 'with state', state)
+    cs.info('push', this.location, '->', normalized, 'with state', state)
     this.history.pushState(state, '', normalized.fullPath)
     this.location = normalized
   }
index 13a5aeb99b030e28f430b1be4864d85cbfedd779..d3eb2900bd37aa5952ce3dd6272ea05bc644ee69 100644 (file)
@@ -81,7 +81,7 @@ export function stringifyURL(location: HistoryLocation): string {
   let url = location.path
   let query = location.query ? stringifyQuery(location.query) : ''
 
-  return url + (query.length && '?' + query) + (location.hash || '')
+  return url + (query && '?' + query) + (location.hash || '')
 }
 
 /**
index c3d30e38e2313af17526f9724847ee68a248de71..950eb2afe97d7784a561b3ef69f5b8917ea53551 100644 (file)
@@ -49,11 +49,8 @@ export class Router {
       url = this.history.utils.normalizeLocation(location)
     }
 
-    console.log(location)
-    console.log('---')
     // TODO: call hooks, guards
-    // TODO: navigate
-    // this.history.push(location.fullPath)
+    this.history.push(url)
     this.currentRoute = {
       ...url,
       ...location,