diff --git a/src/lib/config.ts b/src/lib/config.ts index c8d1f6fe..85b87da2 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -106,7 +106,7 @@ const config = { grantPastAttendance: '/admin/attendance', awardMilestone: '/admin/milestone', viewResumes: '/admin/resumes', - manageUserAccess: '/admin/manage-user-access', + manageUserAccess: '/admin/access', store: { items: '/admin/store/items', pickup: '/admin/store/pickup', diff --git a/src/pages/admin/manage-user-access/index.tsx b/src/pages/admin/access/index.tsx similarity index 82% rename from src/pages/admin/manage-user-access/index.tsx rename to src/pages/admin/access/index.tsx index acd49a8a..bfd5b3fd 100644 --- a/src/pages/admin/manage-user-access/index.tsx +++ b/src/pages/admin/access/index.tsx @@ -6,24 +6,12 @@ import manageUserAccess from '@/lib/managers/AdminUserManager'; import { PermissionService, ValidationService } from '@/lib/services'; import { UserAccessUpdates } from '@/lib/types/apiRequests'; import { UserAccessType } from '@/lib/types/enums'; -import { getMessagesFromError } from '@/lib/utils'; -import { AxiosError } from 'axios'; +import { reportError } from '@/lib/utils'; import { GetServerSideProps } from 'next'; import { SubmitHandler, useForm } from 'react-hook-form'; import { AiOutlineMail } from 'react-icons/ai'; import { BsPerson } from 'react-icons/bs'; -// This function needs to be moved to the util class after Sean's PR is merged -function reportError(title: string, error: unknown) { - if (error instanceof AxiosError && error.response?.data?.error) { - showToast(title, getMessagesFromError(error.response.data.error).join('\n\n')); - } else if (error instanceof Error) { - showToast(title, error.message); - } else { - showToast(title, 'Unknown error'); - } -} - const ManageUserAccessPage = () => { const { register,