Replaced HashRouter with BrowserRouter

master
Tudor Stanciu 2021-08-01 01:38:26 +03:00
parent 3842e31dd8
commit 1368c6e97b
2 changed files with 6 additions and 4 deletions

2
.env
View File

@ -1,2 +1,4 @@
REACT_APP_IDENTITY_AUTHENTICATION_URL=https://toodle.ddns.net/identity-server-api/identity/authenticate?UserName={username}&Password={password} REACT_APP_IDENTITY_AUTHENTICATION_URL=https://toodle.ddns.net/identity-server-api/identity/authenticate?UserName={username}&Password={password}
REACT_APP_ENABLE_TEMPLATE_CONTENT=True REACT_APP_ENABLE_TEMPLATE_CONTENT=True
#PUBLIC_URL=/cdn-admin/

View File

@ -1,5 +1,5 @@
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { HashRouter, Route, Switch, Redirect } from "react-router-dom"; import { BrowserRouter, Route, Switch, Redirect } from "react-router-dom";
// components // components
import Layout from "./Layout/Layout"; import Layout from "./Layout/Layout";
@ -24,14 +24,14 @@ export default function App() {
}, [messageCode, t, notify]); }, [messageCode, t, notify]);
return ( return (
<HashRouter basename={process.env.PUBLIC_URL || ""}> <BrowserRouter basename={process.env.PUBLIC_URL || ""}>
<Switch> <Switch>
<Route exact path="/" render={() => <Redirect to="/dashboard" />} /> <Route exact path="/" render={() => <Redirect to="/dashboard" />} />
<PublicRoute path="/login" component={Login} /> <PublicRoute path="/login" component={Login} />
<PrivateRoute path="/" component={Layout} /> <PrivateRoute path="/" component={Layout} />
<Route component={Error} /> <Route component={Error} />
</Switch> </Switch>
</HashRouter> </BrowserRouter>
); );
function PrivateRoute({ component, ...rest }) { function PrivateRoute({ component, ...rest }) {