TeamShiksha / logoexecutive

Logo Executive is your partner in logo exploration. Our platform boasts a collection of APIs designed to simplify the process of obtaining company logos.
https://logoexecutive.vercel.app/
22 stars 14 forks source link

Implement Admin dashboard only accessible to userType: ADMIN. #317

Closed VinayakaHegade closed 3 months ago

VinayakaHegade commented 3 months ago

Summary

closes #311 Implemented Admin dashboard only accessible to userType: ADMIN.

Description

Modified the ProtectedRoute utility component to accept an adminOnly prop. When set to true, the component will check if the authenticated user's userType is 'ADMIN'. If the user is an admin, they will be granted access to the protected route. If the user is not an admin, they will be redirected to the /welcome route. If the user is not authenticated, they will be redirected to Signin page.

How to Test the Changes

  1. Sign in as a non-admin user.
  2. Attempt to navigate to the /admin route. You should be redirected to the /welcome route.
  3. Sign in as an admin user.
  4. Navigate to the /admin route. You should be able to access the Admin Dashboard.

Context (Optional)

Screenshots or Recordings (Optional)

https://github.com/TeamShiksha/logoexecutive/assets/88454618/75998e5b-2fcc-4372-9f49-a392ca6f645a

protected-route-coverage

Checklist