cleanup, api, databuddy
This commit is contained in:
@@ -3,20 +3,14 @@ import { useUserContext } from '../contexts/UserContext'
|
||||
import { Login } from './pages/Login'
|
||||
import { Route, Switch } from 'react-router'
|
||||
import { Dashboard } from './pages/Dashboard'
|
||||
import { NavRoute, AppHeader } from './layout/AppHeader'
|
||||
import { AppHeader } from './layout/AppHeader'
|
||||
import { Profile } from './pages/Profile'
|
||||
import { NewUser } from './forms/NewUser'
|
||||
import { ForgotPassword } from './pages/ForgotPassword'
|
||||
|
||||
export const CoreLayout = () => {
|
||||
const { user } = useUserContext()
|
||||
|
||||
const routes: NavRoute[] = [
|
||||
{ exact: true, path: '/', label: 'Dashboard', component: Dashboard },
|
||||
{ path: '/profile', label: 'Profile', component: Profile },
|
||||
{ path: '/login', label: 'Login', component: Login },
|
||||
{ path: '/new/user', label: 'New User', component: NewUser },
|
||||
]
|
||||
|
||||
if (!user)
|
||||
return (
|
||||
<Layout className="layout">
|
||||
@@ -28,14 +22,16 @@ export const CoreLayout = () => {
|
||||
// header, sidebar, avatar?
|
||||
return (
|
||||
<Layout className="layout">
|
||||
<AppHeader user={user} routes={routes} />
|
||||
<Switch>
|
||||
<Layout.Content>
|
||||
{routes.map(({ exact, path, component }) => (
|
||||
<Route exact={exact} key={path} path={path} component={component} />
|
||||
))}
|
||||
</Layout.Content>
|
||||
</Switch>
|
||||
<AppHeader user={user} />
|
||||
<Layout.Content>
|
||||
<Switch>
|
||||
<Route path="/forgot-password" component={ForgotPassword} />
|
||||
<Route path="/login" component={Login} />
|
||||
<Route path="/new/user" component={NewUser} />
|
||||
<Route path="/profile" component={Profile} />
|
||||
<Route exact path="/" component={Dashboard} />
|
||||
</Switch>
|
||||
</Layout.Content>
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user