Skip to content

Commit

Permalink
fix(router): retuning string path
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Mar 15, 2018
1 parent 7c3cba0 commit f48d817
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions core/src/components/router/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Build, Component, Element, Event, EventEmitter, Listen, Method, Prop }
import { Config, DomController } from '../../index';
import { flattenRouterTree, readRedirects, readRoutes } from './utils/parser';
import { readNavState, writeNavState } from './utils/dom';
import { chainToPath, parsePath, readPath, writePath } from './utils/path';
import { chainToPath, generatePath, parsePath, readPath, writePath } from './utils/path';
import { RouteChain, RouteRedirect, RouterEventDetail } from './utils/interfaces';
import { routeRedirect, routerIDsToChain, routerPathToChain } from './utils/matching';
import { printRoutes } from './utils/debug';
Expand All @@ -14,7 +14,7 @@ import { printRoutes } from './utils/debug';
export class Router {

private routes: RouteChain[];
private previousPath: string[] = null;
private previousPath: string = null;
private redirects: RouteRedirect[];
private busy = false;
private init = false;
Expand Down Expand Up @@ -143,9 +143,10 @@ export class Router {
return readPath(window.location, this.base, this.useHash);
}

private emitRouteChange(path: string[], redirectedFrom: string[]|null) {
private emitRouteChange(path: string[], redirectPath: string[]|null) {
const from = this.previousPath;
const to = path.slice();
const redirectedFrom = redirectPath ? generatePath(redirectPath) : null;
const to = generatePath(path);
this.previousPath = to;
this.ionRouteChanged.emit({
from,
Expand Down
6 changes: 3 additions & 3 deletions core/src/components/router/utils/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export interface NavOutlet {
}

export interface RouterEventDetail {
from: string[]|null;
redirectedFrom: string[]|null;
to: string[];
from: string|null;
redirectedFrom: string|null;
to: string;
}

export interface RouteRedirect {
Expand Down

0 comments on commit f48d817

Please sign in to comment.