Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update status of connector ( Disable / Enable ) #1575

Merged
merged 3 commits into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/screens/Connectors/ConnectorPreview.res
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ let make = (
let updateDetails = useUpdateMethod()
let showToast = ToastState.useShowToast()
let mixpanelEvent = MixpanelHook.useSendEvent()
let fetchConnectorListResponse = ConnectorListHook.useFetchConnectorList()
let connector = UrlUtils.useGetFilterDictFromUrl("")->LogicUtils.getString("name", "")
let {setShowFeedbackModal} = React.useContext(GlobalProvider.defaultContext)
let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Success)
Expand Down Expand Up @@ -354,9 +355,10 @@ let make = (
isConnectorDisabled,
)
let url = getURL(~entityName=CONNECTOR, ~methodType=Post, ~id=Some(connectorID))
let _ = await updateDetails(url, disableConnectorPayload->JSON.Encode.object, Post)
let res = await updateDetails(url, disableConnectorPayload->JSON.Encode.object, Post)
fetchConnectorListResponse()->ignore
setInitialValues(_ => res)
showToast(~message=`Successfully Saved the Changes`, ~toastType=ToastSuccess)
RescriptReactRouter.push(GlobalVars.appendDashboardPath(~url=redirectPath))
} catch {
| Exn.Error(_) => showToast(~message=`Failed to Disable connector!`, ~toastType=ToastError)
}
Expand Down
Loading