Skip to content
This repository has been archived by the owner on Jul 17, 2022. It is now read-only.

Commit

Permalink
fix: re-add ApolloProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Sep 5, 2021
1 parent b15c889 commit e64eaec
Showing 1 changed file with 63 additions and 59 deletions.
122 changes: 63 additions & 59 deletions frontend/src/AppRoot.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { ApolloProvider } from '@apollo/client'
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'
import { apolloClient } from './apolloClient'
import PrivateRoute from './components/PrivateRoute'
import { UserProfileProvider } from './components/UserProfileContext'
import { AuthProvider, useAuth } from './hooks/useAuth'
Expand Down Expand Up @@ -28,67 +30,69 @@ const App = () => {
const { isLoading, isAuthenticated } = useAuth()

return (
<UserProfileProvider>
<Router>
<Switch>
{isDev && (
<Route path={ROUTES.KITCHEN_SINK}>
<KitchenSink />
<ApolloProvider client={apolloClient}>
<UserProfileProvider>
<Router>
<Switch>
{isDev && (
<Route path={ROUTES.KITCHEN_SINK}>
<KitchenSink />
</Route>
)}
{isLoading && (
<Route>
<LoadingPage />
</Route>
)}
<Route path={ROUTES.HOME} exact>
{isAuthenticated ? <HomePage /> : <PublicHomePage />}
</Route>
)}
{isLoading && (
<Route>
<LoadingPage />
<Route path={ROUTES.CONFIRM_EMAIL_WITH_TOKEN} exact>
<ConfirmEmailWithTokenPage />
</Route>
)}
<Route path={ROUTES.HOME} exact>
{isAuthenticated ? <HomePage /> : <PublicHomePage />}
</Route>
<Route path={ROUTES.CONFIRM_EMAIL_WITH_TOKEN} exact>
<ConfirmEmailWithTokenPage />
</Route>
<PrivateRoute path={ROUTES.ADMIN_ROOT} exact>
<AdminPage />
</PrivateRoute>
<Route path={ROUTES.APOLLO_DEMO}>
<ApolloDemoPage />
</Route>
<PrivateRoute path={ROUTES.GROUP_LIST}>
<GroupList />
</PrivateRoute>
<PrivateRoute path={ROUTES.GROUP_CREATE}>
<GroupCreatePage />
</PrivateRoute>
<PrivateRoute path={ROUTES.GROUP_EDIT}>
<GroupEditPage />
</PrivateRoute>
<PrivateRoute path={ROUTES.GROUP_VIEW}>
<GroupViewPage />
</PrivateRoute>
<PrivateRoute path={ROUTES.SHIPMENT_OFFER_CREATE}>
<CreateOfferPage />
</PrivateRoute>
<PrivateRoute path={ROUTES.SHIPMENT_OFFER_VIEW}>
<ViewOfferPage />
</PrivateRoute>
<PrivateRoute path={ROUTES.SHIPMENT_LIST}>
<ShipmentList />
</PrivateRoute>
<PrivateRoute path={ROUTES.SHIPMENT_CREATE}>
<ShipmentCreatePage />
</PrivateRoute>
<PrivateRoute path={ROUTES.SHIPMENT_EDIT}>
<ShipmentEditPage />
</PrivateRoute>
<PrivateRoute path={ROUTES.SHIPMENT_VIEW}>
<ShipmentViewPage />
</PrivateRoute>
<PrivateRoute path="*">
<NotFoundPage />
</PrivateRoute>
</Switch>
</Router>
</UserProfileProvider>
<PrivateRoute path={ROUTES.ADMIN_ROOT} exact>
<AdminPage />
</PrivateRoute>
<Route path={ROUTES.APOLLO_DEMO}>
<ApolloDemoPage />
</Route>
<PrivateRoute path={ROUTES.GROUP_LIST}>
<GroupList />
</PrivateRoute>
<PrivateRoute path={ROUTES.GROUP_CREATE}>
<GroupCreatePage />
</PrivateRoute>
<PrivateRoute path={ROUTES.GROUP_EDIT}>
<GroupEditPage />
</PrivateRoute>
<PrivateRoute path={ROUTES.GROUP_VIEW}>
<GroupViewPage />
</PrivateRoute>
<PrivateRoute path={ROUTES.SHIPMENT_OFFER_CREATE}>
<CreateOfferPage />
</PrivateRoute>
<PrivateRoute path={ROUTES.SHIPMENT_OFFER_VIEW}>
<ViewOfferPage />
</PrivateRoute>
<PrivateRoute path={ROUTES.SHIPMENT_LIST}>
<ShipmentList />
</PrivateRoute>
<PrivateRoute path={ROUTES.SHIPMENT_CREATE}>
<ShipmentCreatePage />
</PrivateRoute>
<PrivateRoute path={ROUTES.SHIPMENT_EDIT}>
<ShipmentEditPage />
</PrivateRoute>
<PrivateRoute path={ROUTES.SHIPMENT_VIEW}>
<ShipmentViewPage />
</PrivateRoute>
<PrivateRoute path="*">
<NotFoundPage />
</PrivateRoute>
</Switch>
</Router>
</UserProfileProvider>
</ApolloProvider>
)
}

Expand Down

0 comments on commit e64eaec

Please sign in to comment.