diff --git a/devsoc24-portal-fe/src/app/edit-idea/edit-idea-form.tsx b/devsoc24-portal-fe/src/app/edit-idea/edit-idea-form.tsx index 76e864c..cfc62dc 100644 --- a/devsoc24-portal-fe/src/app/edit-idea/edit-idea-form.tsx +++ b/devsoc24-portal-fe/src/app/edit-idea/edit-idea-form.tsx @@ -108,7 +108,23 @@ export default function EditIdeaForm() { void toast.promise(handleSubmit(), { loading: `Cooking..`, success: `Idea updated successfully!`, - error: `Something went wrong!`, + error: (err: AxiosError) => { + switch (err.response?.status) { + case 404: + return `Account not found!`; + case 403: + return `User is not a leader`; + case 409: + return `User is not in a team`; + case 400: + return `Please check your input and try again!`; + case 401: + void router.push("/"); + return `Session Expired`; + default: + return `Something went wrong!`; + } + }, }); } diff --git a/devsoc24-portal-fe/src/app/edit-project/edit-subject-form.tsx b/devsoc24-portal-fe/src/app/edit-project/edit-subject-form.tsx index 1a2e6cf..68f93c5 100644 --- a/devsoc24-portal-fe/src/app/edit-project/edit-subject-form.tsx +++ b/devsoc24-portal-fe/src/app/edit-project/edit-subject-form.tsx @@ -107,7 +107,23 @@ export default function EditProjectForm() { void toast.promise(handleSubmit(), { loading: "Cooking...", success: `Project submitted successfully!`, - error: `Something went wrong!`, + error: (err: AxiosError) => { + switch (err.response?.status) { + case 404: + return `Account not found!`; + case 403: + return `User is not a leader`; + case 409: + return `User is not in a team`; + case 400: + return `Please check your input and try again!`; + case 401: + void router.push("/"); + return `Session Expired`; + default: + return `Something went wrong!`; + } + }, }); } diff --git a/devsoc24-portal-fe/src/app/submit-idea/submit-idea-form.tsx b/devsoc24-portal-fe/src/app/submit-idea/submit-idea-form.tsx index 5459fd5..9eef810 100644 --- a/devsoc24-portal-fe/src/app/submit-idea/submit-idea-form.tsx +++ b/devsoc24-portal-fe/src/app/submit-idea/submit-idea-form.tsx @@ -81,8 +81,10 @@ export default function SubmitIdeaForm() { switch (err.response?.status) { case 404: return `Account not found!`; + case 403: + return `User is not a leader`; case 409: - return `Incorrect credentials`; + return `User is not in a team`; case 400: return `Please check your input and try again!`; case 401: diff --git a/devsoc24-portal-fe/src/app/submit-project/submit-project-form.tsx b/devsoc24-portal-fe/src/app/submit-project/submit-project-form.tsx index cb84164..023ea2a 100644 --- a/devsoc24-portal-fe/src/app/submit-project/submit-project-form.tsx +++ b/devsoc24-portal-fe/src/app/submit-project/submit-project-form.tsx @@ -75,6 +75,10 @@ export default function SubmitProjectForm() { }, error: (err: AxiosError) => { switch (err.response?.status) { + case 403: + return `User is not a leader`; + case 409: + return `User is not in a team`; case 404: return `Account not found!`; case 401: