Сценарий:
Я использую React, чтобы иметь возможность сделать свой проект. Я также использую react-router-dom
для маршрутизации приложения. Для этих маршрутов у меня есть следующий код:
import React from 'react'
import { BrowserRouter, Route, Switch, Redirect } from 'react-router-dom'
import isAuthenticated from '~/services/auth/auth'
import history from './history'
import Login from '~/pages/login'
import Menu from '~/pages/menumain'
/* *** SISTEMA *** */
/* Permissões */
import Permissions from '~/pages/sistema/permissoes/permissoes'
import AddPermission from '~/pages/sistema/permissoes/addpermission'
/* *** CADASTRO *** */
/* Usuário */
import ReadUsers from '~/pages/cadastro/usuario/listusers'
import CreateUser from '~/pages/cadastro/usuario/cadusers'
import UpdateUser from '~/pages/cadastro/usuario/edituser'
/* Empresa */
import ReadCompany from '~/pages/cadastro/empresa/listEmpresa'
import CreateCompany from '~/pages/cadastro/empresa/cadEmpresa'
import UpdateCompany from '~/pages/cadastro/empresa/editEmpresa'
/* Contas */
import ReadAccount from '~/pages/cadastro/contas/index'
import CreateAccounts from '~/pages/cadastro/contas/create'
import UpdateAccounts from '~/pages/cadastro/contas/update'
/* Fechamento */
import ReadClosure from '~/pages/cadastro/fechamento/index'
/* *** FLUXO DE CAIXA *** */
import FluxoCaixa from '~/pages/fluxoCaixa/index'
/* *** Ajuda ** */
import Sobre from '~/pages/ajuda/sobre'
/* *** Erro *** */
import Error from '~/pages/error'
import PermissonStatus from '~/pages/getpermissions'
const PrivateRoute = ({ component: Component, ...rest }) => (
<Route
{...rest}
render={props => {
const isAuth = isAuthenticated()
return isAuth ? (
<Component {...props} />
) : (
<Redirect
to={{ pathname: '/login', state: { from: props.location } }}
/>
)
}}
/>
)
const Routes = () => (
<BrowserRouter history={history}>
<Switch>
<Route exact path="/login" component={Login} />
<Route exact path="/fluxocaixa" component={FluxoCaixa} />
<PrivateRoute exact path="/" component={Menu} />
{/* *** SISTEMA *** */}
{/* Permissões */}
<PrivateRoute exact path="/permissions" component={Permissions} />
<PrivateRoute exact path="/permissionModels" component={AddPermission} />
{/* Usuário */}
<PrivateRoute exact path="/readusers" component={ReadUsers} />
<PrivateRoute exact path="/createuser" component={CreateUser} />
<PrivateRoute exact path="/updateuser" component={UpdateUser} />
{/* Empresa */}
<PrivateRoute exact path="/readcompany" component={ReadCompany} />
<PrivateRoute exact path="/createcompany" component={CreateCompany} />
<PrivateRoute exact path="/updatecompany" component={UpdateCompany} />
{/* Contas */}
<PrivateRoute exact path="/readaccounts" component={ReadAccount} />
<PrivateRoute exact path="/createaccounts" component={CreateAccounts} />
<PrivateRoute exact path="/updateaccounts" component={UpdateAccounts} />
{/* Fechamento */}
<PrivateRoute exact path="/readclosure" component={ReadClosure} />
{/* *** Ajuda *** */}
{/* Sobre */}
<PrivateRoute exact path="/about" component={Sobre} />
<PrivateRoute exact path="/permstatus" component={PermissonStatus} />
<Route component={Error} />
<Route exact path="/teste" component={Permissions} />
</Switch>
</BrowserRouter>
)
export default Routes
Цель:
Я публикую этот код в IIS 8.5, и если я получу доступ к маршруту http // localhost: 3000, он возвращает требуемый маршрут.
Проблема:
при входе по http // localhost: 3000 / fluxocaixa я получил эту ошибку:
Что-нибудь для решения этой ошибки?