From e120542c60f84c2d4df668ddb39b5af9c8f4d856 Mon Sep 17 00:00:00 2001 From: zharkovstas Date: Sun, 19 May 2019 11:55:17 +0500 Subject: [PATCH] Fix routing 2 --- src/Welcome.js | 16 ++++++++-------- src/index.js | 10 ++++++++-- src/routes.js | 4 ++-- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/Welcome.js b/src/Welcome.js index 7665c82..46a6736 100644 --- a/src/Welcome.js +++ b/src/Welcome.js @@ -14,28 +14,28 @@ export function Welcome() {

Выберите город

- + Екатеринбург - + Санкт-Петербург - + Новосибирск - + Пермь - + Ижевск - + Казань - + Самара - + Лондон diff --git a/src/index.js b/src/index.js index c3a3604..52e8c2a 100644 --- a/src/index.js +++ b/src/index.js @@ -5,10 +5,16 @@ import * as serviceWorker from './serviceWorker'; import { router } from './router'; import { render } from './render'; -router.resolve(window.location.pathname).then(render); +router.resolve({ + pathname: window.location.pathname || '', + query: new URLSearchParams(window.location.search || '') +}).then(render); window.onpopstate = function() { - router.resolve(window.location.pathname).then(render); + router.resolve({ + pathname: window.location.pathname || '', + query: new URLSearchParams(window.location.search || '') +}).then(render); }; // If you want your app to work offline and load faster, you can change diff --git a/src/routes.js b/src/routes.js index 7282a56..10d44e1 100644 --- a/src/routes.js +++ b/src/routes.js @@ -10,8 +10,8 @@ export const routes = [ action: Welcome }, { - path: '/game/:city', - action: (context) => + path: '/game', + action: (context) => }, { path: '(.*)', -- 2.50.1