mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-12 11:46:40 +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 React from "react";
|
||||||
import { Router } from "react-router-dom";
|
import { Router } from "react-router-dom";
|
||||||
import { useAuth0 } from "./authentication/auth0";
|
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 MainLayout from "./layouts/MainLayout";
|
||||||
import { AppRouter } from "./utils/router";
|
import { AppRouter } from "./routes/AppRouter";
|
||||||
|
|
||||||
export const history = createHistory.createBrowserHistory();
|
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const { loading } = useAuth0();
|
const { loading } = useAuth0();
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ import App from "./App";
|
||||||
import * as serviceWorker from "./serviceWorker";
|
import * as serviceWorker from "./serviceWorker";
|
||||||
import { Auth0Provider } from "./authentication/auth0";
|
import { Auth0Provider } from "./authentication/auth0";
|
||||||
import config from "./authentication/config.json";
|
import config from "./authentication/config.json";
|
||||||
import history from "./utils/history";
|
import { history } from "./utils/history";
|
||||||
|
|
||||||
const onRedirectCallback = appState => {
|
const onRedirectCallback = (appState) => {
|
||||||
history.push(
|
history.push(
|
||||||
appState && appState.targetUrl
|
appState && appState.targetUrl
|
||||||
? appState.targetUrl
|
? appState.targetUrl
|
||||||
|
|
@ -18,6 +18,7 @@ ReactDOM.render(
|
||||||
<Auth0Provider
|
<Auth0Provider
|
||||||
domain={config.domain}
|
domain={config.domain}
|
||||||
client_id={config.clientId}
|
client_id={config.clientId}
|
||||||
|
audience={config.audience}
|
||||||
redirect_uri={window.location.origin}
|
redirect_uri={window.location.origin}
|
||||||
onRedirectCallback={onRedirectCallback}
|
onRedirectCallback={onRedirectCallback}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,14 @@ import { ProjectController } from "../controllers/ProjectController";
|
||||||
import { UserController } from "../controllers/UserController";
|
import { UserController } from "../controllers/UserController";
|
||||||
import { TicketController } from "../controllers/TicketController";
|
import { TicketController } from "../controllers/TicketController";
|
||||||
import { NotFoundPage } from "../pages/NotFoundPage";
|
import { NotFoundPage } from "../pages/NotFoundPage";
|
||||||
|
import { TestPage } from "../pages/TestPage";
|
||||||
|
|
||||||
export const AppRouter = () => {
|
export const AppRouter = () => {
|
||||||
return (
|
return (
|
||||||
<Switch>
|
<Switch>
|
||||||
{/* <PrivateRoute exact path="/test">
|
<Route exact path="/test">
|
||||||
<TestPage />
|
<TestPage />
|
||||||
</PrivateRoute> */}
|
</Route>
|
||||||
|
|
||||||
<Route exact path="/">
|
<Route exact path="/">
|
||||||
<HomeController />
|
<HomeController />
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
import { createBrowserHistory } from "history";
|
import * as createHistory from "history";
|
||||||
export default createBrowserHistory;
|
export const history = createHistory.createBrowserHistory();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es5",
|
"target": "es6",
|
||||||
"lib": ["dom", "dom.iterable", "esnext"],
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
|
@ -13,7 +13,14 @@
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"noEmit": 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"]
|
"include": ["src"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue