Fix admin/user login issues

This commit is contained in:
John Lyon-Smith
2018-05-25 10:16:28 -07:00
parent a33ca57d58
commit 587052a509
22 changed files with 255 additions and 92 deletions

View File

@@ -2,6 +2,7 @@ import React, { Component } from "react"
import {
Login,
Logout,
Parking,
ResetPassword,
ForgotPassword,
ConfirmEmail,
@@ -29,18 +30,38 @@ export class App extends Component {
<BrowserRouter>
<Column minHeight="100vh">
<Route
path="/app"
path="/admin"
render={(props) => (
<Column.Item height={sizeInfo.headerHeight}>
<Header
{...props}
left={[
{ image: require("images/badge.png"), path: "/app/home" },
{ text: "Teams", path: "/app/teams" },
{ text: "Users", path: "/app/users" },
{ image: require("images/badge.png"), path: "/admin/home" },
{ text: "Teams", path: "/admin/teams" },
{ text: "Users", path: "/admin/users" },
]}
right={[
{ icon: "profile", path: "/app/profile" },
{ icon: "profile", path: "/admin/profile" },
{ icon: "logout", path: "/logout" },
]}
/>
</Column.Item>
)}
/>
<Route
path="/user"
render={(props) => (
<Column.Item height={sizeInfo.headerHeight}>
<Header
{...props}
left={[
{
image: require("images/badge.png"),
path: "/user/profile",
},
]}
right={[
{ icon: "profile", path: "/user/profile" },
{ icon: "logout", path: "/logout" },
]}
/>
@@ -50,18 +71,30 @@ export class App extends Component {
<Switch>
<Route exact path="/login" component={Login} />
<Route exact path="/logout" component={Logout} />
<Route exact path="/parking" component={Parking} />
<Route exact path="/confirm-email" component={ConfirmEmail} />
<Route exact path="/reset-password" component={ResetPassword} />
<Route exact path="/forgot-password" component={ForgotPassword} />
<ProtectedRoute exact path="/app/profile" component={Profile} />
<ProtectedRoute exact admin path="/app/home" component={Home} />
<ProtectedRoute exact admin path="/app/teams" component={Teams} />
<ProtectedRoute exact admin path="/app/system" component={System} />
<ProtectedRoute exact admin path="/app/users" component={Users} />
<DefaultRoute redirect="/app/home" />
<ProtectedRoute exact path="/user/profile" component={Profile} />
<ProtectedRoute
exact
admin
path="/admin/profile"
component={Profile}
/>
<ProtectedRoute exact admin path="/admin/home" component={Home} />
<ProtectedRoute exact admin path="/admin/teams" component={Teams} />
<ProtectedRoute
exact
admin
path="/admin/system"
component={System}
/>
<ProtectedRoute exact admin path="/admin/users" component={Users} />
<DefaultRoute user="/user/profile" admin="/admin/home" />
</Switch>
<Route
path="/app"
path="/(user|admin)"
render={() => (
<Column.Item>
<Footer