mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-06 00:36:39 +00:00
creates routes folder for AppROuter and PrivateRoute; [BUG] fix error after login
This commit is contained in:
parent
1bf2da3d32
commit
7115d28044
6 changed files with 19 additions and 13 deletions
|
|
@ -1,12 +1,9 @@
|
|||
import React from "react";
|
||||
import { Router } from "react-router-dom";
|
||||
import { useAuth0 } from "./authentication/auth0";
|
||||
import * as createHistory from "history";
|
||||
// import history from "./utils/history";
|
||||
import { history } from "./utils/history";
|
||||
import MainLayout from "./layouts/MainLayout";
|
||||
import { AppRouter } from "./utils/router";
|
||||
|
||||
export const history = createHistory.createBrowserHistory();
|
||||
import { AppRouter } from "./routes/AppRouter";
|
||||
|
||||
export default function App() {
|
||||
const { loading } = useAuth0();
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ import App from "./App";
|
|||
import * as serviceWorker from "./serviceWorker";
|
||||
import { Auth0Provider } from "./authentication/auth0";
|
||||
import config from "./authentication/config.json";
|
||||
import history from "./utils/history";
|
||||
import { history } from "./utils/history";
|
||||
|
||||
const onRedirectCallback = appState => {
|
||||
const onRedirectCallback = (appState) => {
|
||||
history.push(
|
||||
appState && appState.targetUrl
|
||||
? appState.targetUrl
|
||||
|
|
@ -18,6 +18,7 @@ ReactDOM.render(
|
|||
<Auth0Provider
|
||||
domain={config.domain}
|
||||
client_id={config.clientId}
|
||||
audience={config.audience}
|
||||
redirect_uri={window.location.origin}
|
||||
onRedirectCallback={onRedirectCallback}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -5,13 +5,14 @@ import { ProjectController } from "../controllers/ProjectController";
|
|||
import { UserController } from "../controllers/UserController";
|
||||
import { TicketController } from "../controllers/TicketController";
|
||||
import { NotFoundPage } from "../pages/NotFoundPage";
|
||||
import { TestPage } from "../pages/TestPage";
|
||||
|
||||
export const AppRouter = () => {
|
||||
return (
|
||||
<Switch>
|
||||
{/* <PrivateRoute exact path="/test">
|
||||
<Route exact path="/test">
|
||||
<TestPage />
|
||||
</PrivateRoute> */}
|
||||
</Route>
|
||||
|
||||
<Route exact path="/">
|
||||
<HomeController />
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
import { createBrowserHistory } from "history";
|
||||
export default createBrowserHistory;
|
||||
import * as createHistory from "history";
|
||||
export const history = createHistory.createBrowserHistory();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"target": "es6",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
|
|
@ -13,7 +13,14 @@
|
|||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react"
|
||||
"jsx": "react",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"emitDecoratorMetadata": true,
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"importHelpers": true,
|
||||
"typeRoots": ["node_modules/@types"]
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue