From aafd0d95438041e4bb74ca4f2ff6fa7a94c2ef7b Mon Sep 17 00:00:00 2001 From: Shaelyn Tolkamp <46355612+tolkamps1@users.noreply.github.com> Date: Fri, 14 Jun 2024 08:11:12 -0700 Subject: [PATCH] [EPICSYSTEM-96] redirect unpublished engagements to homepage. (#62) --- met-api/src/met_api/resources/engagement.py | 4 ++-- met-web/src/components/engagement/view/ActionContext.tsx | 9 ++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/met-api/src/met_api/resources/engagement.py b/met-api/src/met_api/resources/engagement.py index f13803045..89046dd63 100644 --- a/met-api/src/met_api/resources/engagement.py +++ b/met-api/src/met_api/resources/engagement.py @@ -51,9 +51,9 @@ def get(engagement_id): if engagement_record: return engagement_record, HTTPStatus.OK - return 'Engagement was not found', HTTPStatus.INTERNAL_SERVER_ERROR + return 'Engagement was not found', HTTPStatus.NOT_FOUND except KeyError: - return 'Engagement was not found', HTTPStatus.INTERNAL_SERVER_ERROR + return 'Engagement was not found', HTTPStatus.NOT_FOUND except ValueError as err: return str(err), HTTPStatus.INTERNAL_SERVER_ERROR diff --git a/met-web/src/components/engagement/view/ActionContext.tsx b/met-web/src/components/engagement/view/ActionContext.tsx index e1e3f6bd8..478bf75fb 100644 --- a/met-web/src/components/engagement/view/ActionContext.tsx +++ b/met-web/src/components/engagement/view/ActionContext.tsx @@ -164,12 +164,7 @@ export const ActionProvider = ({ children }: { children: JSX.Element | JSX.Eleme setSavedEngagement({ ...result }); setEngagementLoading(false); } catch (error) { - dispatch( - openNotification({ - severity: 'error', - text: 'Error occurred while fetching Engagement information', - }), - ); + navigate('/'); } }; @@ -186,7 +181,7 @@ export const ActionProvider = ({ children }: { children: JSX.Element | JSX.Eleme dispatch( openNotification({ severity: 'error', - text: 'Error occurred while fetching Engagement wdigets', + text: 'Error occurred while fetching Engagement widgets', }), ); }