diff options
Diffstat (limited to 'vnext/src/App.js')
-rw-r--r-- | vnext/src/App.js | 80 |
1 files changed, 45 insertions, 35 deletions
diff --git a/vnext/src/App.js b/vnext/src/App.js index 4c1e72d1..4251d52c 100644 --- a/vnext/src/App.js +++ b/vnext/src/App.js @@ -30,15 +30,14 @@ export default function App() { useEffect(() => { svg4everybody(); + let params = qs.parse(window.location.search.substring(1)); + if (params.hash) { + cookie.save('hash', params.hash, { path: '/' }); + let retpath = params.retpath || `${window.location.protocol}//${window.location.host}${window.location.pathname}`; + window.history.replaceState({}, document.title, retpath); + } }, []); - let params = qs.parse(window.location.search.substring(1)); - if (params.hash) { - cookie.save('hash', params.hash, { path: '/' }); - let retpath = params.retpath || `${window.location.protocol}//${window.location.host}${window.location.pathname}`; - window.history.replaceState({}, document.title, retpath); - } - /** * @type {import('./api').SecureUser} */ @@ -135,17 +134,6 @@ export default function App() { }, [hash]); /** - * @param {{ pathname: any; search: string; }[]} history - * @param {any} pathname - * @param {any} searchString - */ - let search = (history, pathname, searchString) => { - let location = {}; - location.pathname = pathname; - location.search = `?search=${searchString}`; - history.push(location); - }; - /** * @param {import("./api").SecureUser} visitor */ let auth = (visitor) => { @@ -163,23 +151,45 @@ export default function App() { <div id="wrapper"> <section id="content" ref={contentRef} className={scrollState.top ? elClassTop : ''}> <Switch> - <Route exact path="/" render={(props) => <Discussions visitor={visitor} {...props} />} /> - <Route exact path="/home" render={(props) => <Home visitor={visitor} {...props} />} /> - <Route exact path="/discover" render={(props) => - <Discover visitor={visitor} {...props} /> - } /> - <Route exact path="/settings" render={(props) => - <Settings visitor={visitor} {...props} onChange={auth} /> - } /> - <Route exact path="/login" render={(props) => <Login visitor={visitor} {...props} onAuth={auth} />} /> - <Route exact path="/post" render={(props) => <Post visitor={visitor} {...props} />} /> - <Route exact path="/pm" render={(props) => <Contacts visitor={visitor} {...props} />} /> - <Route exact path="/pm/:user" render={(props) => <Chat connection={eventSource} visitor={visitor} {...props} />} /> - <Route exact path="/:user/friends" render={(props) => <Friends visitor={visitor} {...props} />} /> - <Route exact path="/:user/readers" render={(props) => <Readers visitor={visitor} {...props} />} /> - <Route exact path="/:user" render={(props) => <Blog visitor={visitor} {...props} />} /> - <Route exact path="/tag/:tag" render={(props) => <Tag visitor={visitor} {...props} />} /> - <Route exact path="/:user/:mid" render={(props) => <Thread connection={eventSource} visitor={visitor} {...props} />} /> + <Route exact path="/"> + <Discussions visitor={visitor} /> + </Route> + <Route exact path="/home"> + <Home visitor={visitor} /> + </Route> + <Route exact path="/discover"> + <Discover visitor={visitor} /> + </Route> + <Route exact path="/settings"> + <Settings visitor={visitor} onChange={auth} /> + </Route> + <Route exact path="/login"> + <Login visitor={visitor} onAuth={auth} /> + </Route> + <Route exact path="/post"> + <Post visitor={visitor} /> + </Route> + <Route exact path="/pm"> + <Contacts visitor={visitor} /> + </Route> + <Route exact path="/pm/:user"> + <Chat connection={eventSource} visitor={visitor} /> + </Route> + <Route exact path="/:user/friends"> + <Friends visitor={visitor} /> + </Route> + <Route exact path="/:user/readers"> + <Readers visitor={visitor} /> + </Route> + <Route exact path="/:user"> + <Blog visitor={visitor} /> + </Route> + <Route exact path="/tag/:tag"> + <Tag visitor={visitor} /> + </Route> + <Route exact path="/:user/:mid"> + <Thread connection={eventSource} visitor={visitor} /> + </Route> </Switch> </section> { |