Pass existing integration id to test_connection (#4131)
# What this PR does Pass existing integration id to `test_connection` servicenow endpoint
This commit is contained in:
parent
9256fbd12c
commit
c1766d9fc2
2 changed files with 9 additions and 3 deletions
|
|
@ -53,7 +53,7 @@ export const ServiceNowAuthSection: React.FC = observer(() => {
|
|||
};
|
||||
|
||||
setIsAuthTestRunning(true);
|
||||
const result = await AlertReceiveChannelHelper.testServiceNowAuthentication({ data });
|
||||
const result = await AlertReceiveChannelHelper.testServiceNowAuthentication({ id: currentIntegration?.id, data });
|
||||
setAuthTestResult(result);
|
||||
setIsAuthTestRunning(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,14 +74,20 @@ export class AlertReceiveChannelHelper {
|
|||
}
|
||||
|
||||
static async testServiceNowAuthentication({
|
||||
id,
|
||||
data,
|
||||
}: {
|
||||
id: ApiSchemas['AlertReceiveChannel']['id'];
|
||||
data: OmitReadonlyMembers<ApiSchemas['AlertReceiveChannelUpdate']>;
|
||||
}) {
|
||||
try {
|
||||
const result = await onCallApi({ skipErrorHandling: false }).POST('/alert_receive_channels/test_connection/', {
|
||||
const endpoint = id
|
||||
? '/alert_receive_channels/{id}/test_connection/'
|
||||
: '/alert_receive_channels/test_connection/';
|
||||
|
||||
const result = await onCallApi({ skipErrorHandling: false }).POST(endpoint, {
|
||||
body: data as ApiSchemas['AlertReceiveChannelUpdate'],
|
||||
params: {},
|
||||
params: { path: { id } },
|
||||
});
|
||||
return result?.response.status === 200;
|
||||
} catch (ex) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue