From bb90f0bb4f22b16135fb36dbcd1184565e01517d Mon Sep 17 00:00:00 2001 From: XnpioChV Date: Wed, 4 Dec 2024 14:34:32 -0500 Subject: [PATCH] style: Some nits on the code --- src/generic/toast-context/index.test.tsx | 1 - src/library-authoring/library-team/LibraryTeam.test.tsx | 2 +- src/library-authoring/library-team/LibraryTeam.tsx | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/generic/toast-context/index.test.tsx b/src/generic/toast-context/index.test.tsx index 21fa78143..11294b069 100644 --- a/src/generic/toast-context/index.test.tsx +++ b/src/generic/toast-context/index.test.tsx @@ -9,7 +9,6 @@ export interface WraperProps { children: React.ReactNode; } -// eslint-disable-next-line react/prop-types const TestComponentToShow = () => { const { showToast } = React.useContext(ToastContext); diff --git a/src/library-authoring/library-team/LibraryTeam.test.tsx b/src/library-authoring/library-team/LibraryTeam.test.tsx index fd50a0927..bdd424fc0 100644 --- a/src/library-authoring/library-team/LibraryTeam.test.tsx +++ b/src/library-authoring/library-team/LibraryTeam.test.tsx @@ -211,7 +211,7 @@ describe('', () => { it('shows error', async () => { const url = getLibraryTeamApiUrl(libraryId); const axiosMock = new MockAdapter(getAuthenticatedHttpClient()); - axiosMock.onPost(url).reply(400, { error: 'Error' }); + axiosMock.onPost(url).reply(400, {}); await renderLibraryTeam(); diff --git a/src/library-authoring/library-team/LibraryTeam.tsx b/src/library-authoring/library-team/LibraryTeam.tsx index dcb882079..8bf4d2e31 100644 --- a/src/library-authoring/library-team/LibraryTeam.tsx +++ b/src/library-authoring/library-team/LibraryTeam.tsx @@ -66,8 +66,8 @@ const LibraryTeam: React.FC> = () => { }).then(() => { showToast(intl.formatMessage(messages.addMemberSuccess)); }).catch((addMemberError) => { - const errorData = addMemberError.response.data; - if ('email' in errorData) { + const errorData = typeof addMemberError === 'object' ? addMemberError.response?.data : undefined; + if (errorData && 'email' in errorData) { showToast(intl.formatMessage(messages.addMemberEmailError)); } else { showToast(intl.formatMessage(messages.addMemberError));