From 078101df70dc6aab0f9f4faa37725aa6b47d3c5e Mon Sep 17 00:00:00 2001 From: lavanya-bmw Date: Wed, 21 Feb 2024 15:23:55 +0530 Subject: [PATCH] feat(IDP): removed duplicate api --- src/components/overlays/EnableIDP/DisableManagedIdp.tsx | 6 +++--- src/features/admin/idpApiSlice.ts | 8 -------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/components/overlays/EnableIDP/DisableManagedIdp.tsx b/src/components/overlays/EnableIDP/DisableManagedIdp.tsx index 1f894d31a..743f7a7ae 100644 --- a/src/components/overlays/EnableIDP/DisableManagedIdp.tsx +++ b/src/components/overlays/EnableIDP/DisableManagedIdp.tsx @@ -29,7 +29,7 @@ import { import { useDispatch } from 'react-redux' import { closeOverlay } from 'features/control/overlay' import { - useDisableIDPMutation, + useEnableIDPMutation, useFetchIDPDetailQuery, } from 'features/admin/idpApiSlice' import { success } from 'services/NotifyService' @@ -39,7 +39,7 @@ export const DisableManagedIDP = ({ id }: { id: string }) => { const { t } = useTranslation('idp') const dispatch = useDispatch() const { data, refetch } = useFetchIDPDetailQuery(id) - const [disableIDP] = useDisableIDPMutation() + const [enableIDP] = useEnableIDPMutation() const [loading, setLoading] = useState(false) const [enableErrorMessage, setEnableErrorMessage] = useState(false) const enabled = data?.enabled @@ -53,7 +53,7 @@ export const DisableManagedIDP = ({ id }: { id: string }) => { ) => { setLoading(true) try { - data && (await disableIDP({ id, enabled: !enabled })) + data && (await enableIDP({ id, enabled: !enabled })) dispatch(closeOverlay()) success( enabled diff --git a/src/features/admin/idpApiSlice.ts b/src/features/admin/idpApiSlice.ts index 6440047fe..802b8dc5b 100644 --- a/src/features/admin/idpApiSlice.ts +++ b/src/features/admin/idpApiSlice.ts @@ -258,13 +258,6 @@ export const apiSlice = createApi({ query: (useridp: UserIdentityProvider) => `/api/administration/identityprovider/owncompany/users/${useridp.companyUserId}/identityprovider/${useridp.identityProviderId}`, }), - disableIDP: builder.mutation({ - query: (status: IDPStatus) => ({ - url: `/api/administration/identityprovider/owncompany/identityproviders/${status.id}/status?enabled=${status.enabled}`, - method: 'POST', - }), - invalidatesTags: [TAGS.IDP], - }), }), }) @@ -280,7 +273,6 @@ export const { useRemoveIDPMutation, useEnableIDPMutation, useUpdateUserIDPMutation, - useDisableIDPMutation, } = apiSlice export default slice