Skip to content

Commit

Permalink
fix: handle QS for default route
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelkaron committed Jul 8, 2019
1 parent 79628f4 commit eef3d23
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,18 @@ export class XstateRouterNavigo implements ComponentInterface {
(acc, { path, handler }) => ({
...acc,
[path]: (params: Record<string, any>, query: string) =>
handler({ ...params, ...(this.useQs && parse(query)) })
handler(
// parsing QS for params?
this.useQs
? // is this the default handler
path === '/'
? // query is passed as params
parse((params as unknown) as string)
: // combine params and query
{ ...params, ...parse(query) }
: // since we're not parsing QS just pass params
params
)
}),
{}
)
Expand Down

0 comments on commit eef3d23

Please sign in to comment.