-
Notifications
You must be signed in to change notification settings - Fork 0
SSF-122 auth page frontend #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e8cc48d
19e1ab9
9023c75
7028b2f
054f777
a6ec60d
7cedc02
ae37d4a
e93022b
b26af83
a0a9058
507dd34
b407c0f
360f01c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,45 +21,17 @@ import AdminDonation from '@containers/adminDonation'; | |
| import { pantryIdLoader } from '@loaders/pantryIdLoader'; | ||
| import Homepage from '@containers/homepage'; | ||
| import AdminOrderManagement from '@containers/adminOrderManagement'; | ||
| import '@aws-amplify/ui-react/styles.css'; | ||
| import { Authenticator } from '@aws-amplify/ui-react'; | ||
| import { Amplify } from 'aws-amplify'; | ||
| import CognitoAuthConfig from './aws-exports'; | ||
| import LoginPage from '@containers/loginPage'; | ||
| import SignupPage from '@containers/signupPage'; | ||
| import ForgotPasswordPage from '@containers/forgotPasswordPage'; | ||
| import ProtectedRoute from '@components/protectedRoute'; | ||
| import { Button } from '@chakra-ui/react'; | ||
| import Unauthorized from '@containers/unauthorized'; | ||
|
|
||
| Amplify.configure(CognitoAuthConfig); | ||
|
|
||
| const components = { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same with this for the routes that still use authenticator |
||
| SignUp: { | ||
| Footer() { | ||
| return ( | ||
| <> | ||
| <Button as="a" href="/pantry-application"> | ||
| {' '} | ||
| Sign up to be pantry partner{' '} | ||
| </Button> | ||
| <Button> Log donation for one-time donors </Button> | ||
| </> | ||
| ); | ||
| }, | ||
| }, | ||
|
|
||
| SignIn: { | ||
| Footer() { | ||
| return ( | ||
| <> | ||
| <Button as="a" href="/pantry-application"> | ||
| {' '} | ||
| Sign up to be pantry partner{' '} | ||
| </Button> | ||
| <Button> Log donation for one-time donors </Button> | ||
| </> | ||
| ); | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| const router = createBrowserRouter([ | ||
| { | ||
| path: '/', | ||
|
|
@@ -75,6 +47,18 @@ const router = createBrowserRouter([ | |
| path: '/landing-page', | ||
| element: <LandingPage />, | ||
| }, | ||
| { | ||
| path: '/login', | ||
| element: <LoginPage />, | ||
| }, | ||
| { | ||
| path: '/signup', | ||
| element: <SignupPage />, | ||
| }, | ||
| { | ||
| path: '/forgot-password', | ||
| element: <ForgotPasswordPage />, | ||
| }, | ||
| { | ||
| path: '/pantry-application', | ||
| element: <PantryApplication />, | ||
|
|
@@ -92,17 +76,17 @@ const router = createBrowserRouter([ | |
| { | ||
| path: '/pantry-overview', | ||
| element: ( | ||
| <Authenticator components={components}> | ||
| <ProtectedRoute> | ||
| <PantryOverview /> | ||
| </Authenticator> | ||
| </ProtectedRoute> | ||
| ), | ||
| }, | ||
| { | ||
| path: '/pantry-dashboard/:pantryId', | ||
| element: ( | ||
| <Authenticator components={components}> | ||
| <ProtectedRoute> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note for later: The pantry id loader I think makes u navigate to a 404 error instead (while still navigating to request-form/1). I think my role based auth backend may have fixed this, but once this get's merged in we should check to see if it still works. If not, we may need to adjust how the ProtectedRoute and loader interact with each other.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok sounds good! |
||
| <PantryDashboard /> | ||
| </Authenticator> | ||
| </ProtectedRoute> | ||
| ), | ||
| }, | ||
| { | ||
|
|
@@ -141,82 +125,82 @@ const router = createBrowserRouter([ | |
| { | ||
| path: '/pantry-past-orders', | ||
| element: ( | ||
| <Authenticator components={components}> | ||
| <ProtectedRoute> | ||
| <PantryPastOrders /> | ||
| </Authenticator> | ||
| </ProtectedRoute> | ||
| ), | ||
| }, | ||
| { | ||
| path: '/pantries', | ||
| element: ( | ||
| <Authenticator components={components}> | ||
| <ProtectedRoute> | ||
| <Pantries /> | ||
| </Authenticator> | ||
| </ProtectedRoute> | ||
| ), | ||
| }, | ||
| { | ||
| path: '/food-manufacturer-order-dashboard', | ||
| element: ( | ||
| <Authenticator components={components}> | ||
| <ProtectedRoute> | ||
| <FoodManufacturerOrderDashboard /> | ||
| </Authenticator> | ||
| </ProtectedRoute> | ||
| ), | ||
| }, | ||
| { | ||
| path: '/orders', | ||
| element: ( | ||
| <Authenticator components={components}> | ||
| <ProtectedRoute> | ||
| <Orders /> | ||
| </Authenticator> | ||
| </ProtectedRoute> | ||
| ), | ||
| }, | ||
| { | ||
| path: '/request-form/:pantryId', | ||
| element: ( | ||
| <Authenticator components={components}> | ||
| <ProtectedRoute> | ||
| <FormRequests /> | ||
| </Authenticator> | ||
| </ProtectedRoute> | ||
| ), | ||
| loader: pantryIdLoader, | ||
| }, | ||
| { | ||
| path: '/approve-pantries', | ||
| path: '/donation-mangement', | ||
| element: ( | ||
| <Authenticator components={components}> | ||
| <ApprovePantries /> | ||
| </Authenticator> | ||
| <ProtectedRoute> | ||
| <DonationManagement /> | ||
| </ProtectedRoute> | ||
| ), | ||
| }, | ||
| { | ||
| path: '/donation-management', | ||
| path: '/approve-pantries', | ||
| element: ( | ||
| <Authenticator components={components}> | ||
| <DonationManagement /> | ||
| </Authenticator> | ||
| <ProtectedRoute> | ||
| <ApprovePantries /> | ||
| </ProtectedRoute> | ||
| ), | ||
| }, | ||
| { | ||
| path: '/admin-donation', | ||
| element: ( | ||
| <Authenticator components={components}> | ||
| <ProtectedRoute> | ||
| <AdminDonation /> | ||
| </Authenticator> | ||
| </ProtectedRoute> | ||
| ), | ||
| }, | ||
| { | ||
| path: '/volunteer-management', | ||
| element: ( | ||
| <Authenticator components={components}> | ||
| <ProtectedRoute> | ||
| <VolunteerManagement /> | ||
| </Authenticator> | ||
| </ProtectedRoute> | ||
| ), | ||
| }, | ||
| { | ||
| path: '/admin-order-management', | ||
| element: ( | ||
| <Authenticator components={components}> | ||
| <ProtectedRoute> | ||
| <AdminOrderManagement /> | ||
| </Authenticator> | ||
| </ProtectedRoute> | ||
| ), | ||
| }, | ||
| // Actions | ||
|
|
@@ -233,11 +217,12 @@ const router = createBrowserRouter([ | |
| ]); | ||
|
|
||
| export const App: React.FC = () => { | ||
| return ( | ||
| <Authenticator.Provider> | ||
| <RouterProvider router={router} /> | ||
| </Authenticator.Provider> | ||
| ); | ||
| useEffect(() => { | ||
| document.title = 'SSF'; | ||
| apiClient.getHello().then((res) => console.log(res)); | ||
| }, []); | ||
|
|
||
| return <RouterProvider router={router} />; | ||
| }; | ||
|
|
||
| export default App; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are still some routes that use authenticator, and that's causing an error for me without this