0

I have a client area with login, and the login has a different template dashboard. when finished I already have a rendering error: "Failed prop type: The following properties are not supported: location,computedMatch. Please remove them But still he rendered normal". Now comes my problem, I want to add an administrative area with another template. but I can not. enter image description here

So I have a component and in this component I check if the client is logged in, if not I make a redirect to login page. In my other admin area component I don't use this but I am still redirected to the client login screen.

<Router>
<Switch>
    {/* area client */}
    <Route component={Login} path='/login' />


    <MuiThemeProvider theme={theme}>
        <Layout>
            <Route exact path='/' component={Dashboard} />
            ...

        </Layout>
    </MuiThemeProvider>
    {/* area admin */}
    <MuiThemeProvider theme={theme}>
        <>
            <Route path='/admin/login' component={LoginAadmin} />
            <Route path='/admin' component={Admin} />

        </>
    </MuiThemeProvider>
</Switch>

could someone help me fix these routes?

1 Answers1

0

I managed to solve by following this post: Multiple Nested Routes in react-router-dom v4

from @Igor Stetsiura it was like this:

    render() {
    return (


        <MuiThemeProvider theme={theme}>
            <Switch>
                <Route path='/admin/login' component={LoginAadmin} />
                <Route path='/login' component={Login} />

                <Route path='/admin/' component={({ match }) =>
                    <LayoutAdmin>
                        <Route exact path='/admin' component={Admin} />
                    </LayoutAdmin>
                } />

                <Route path='/' component={({ match }) =>
                    <Layout>
                        <Route exact path='/' component={Dashboard} />
                        ...

                    </Layout>
                } />

            </Switch>

        </MuiThemeProvider>

    );
}