Skip to content

Commit

Permalink
feat(IDP): removed duplicate api
Browse files Browse the repository at this point in the history
  • Loading branch information
lavanya-bmw committed Feb 21, 2024
1 parent 851b190 commit 078101d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/components/overlays/EnableIDP/DisableManagedIdp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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<boolean>(false)
const enabled = data?.enabled
Expand All @@ -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
Expand Down
8 changes: 0 additions & 8 deletions src/features/admin/idpApiSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,6 @@ export const apiSlice = createApi({
query: (useridp: UserIdentityProvider) =>
`/api/administration/identityprovider/owncompany/users/${useridp.companyUserId}/identityprovider/${useridp.identityProviderId}`,
}),
disableIDP: builder.mutation<IdentityProvider, IDPStatus>({
query: (status: IDPStatus) => ({
url: `/api/administration/identityprovider/owncompany/identityproviders/${status.id}/status?enabled=${status.enabled}`,
method: 'POST',
}),
invalidatesTags: [TAGS.IDP],
}),
}),
})

Expand All @@ -280,7 +273,6 @@ export const {
useRemoveIDPMutation,
useEnableIDPMutation,
useUpdateUserIDPMutation,
useDisableIDPMutation,
} = apiSlice

export default slice

0 comments on commit 078101d

Please sign in to comment.