mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-10-12 21:41:32 +08:00

* chore(error): integrate new errors for channels create and test * chore(error): update all the channel APIs * chore(error): update the edit org http issue * chore(error): fix create channel test * chore(error): fix create channel test * chore(error): fix create channel test * chore(error): fix create channel test * chore(error): remove console logs
37 lines
887 B
TypeScript
37 lines
887 B
TypeScript
import axios from 'api';
|
|
import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
|
|
import { AxiosError } from 'axios';
|
|
import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
|
|
import { PayloadProps, Props } from 'types/api/channels/createOpsgenie';
|
|
|
|
const testOpsgenie = async (
|
|
props: Props,
|
|
): Promise<SuccessResponseV2<PayloadProps>> => {
|
|
try {
|
|
const response = await axios.post<PayloadProps>('/testChannel', {
|
|
name: props.name,
|
|
opsgenie_configs: [
|
|
{
|
|
api_key: props.api_key,
|
|
description: props.description,
|
|
priority: props.priority,
|
|
message: props.message,
|
|
details: {
|
|
...props.detailsArray,
|
|
},
|
|
},
|
|
],
|
|
});
|
|
|
|
return {
|
|
httpStatusCode: response.status,
|
|
data: response.data,
|
|
};
|
|
} catch (error) {
|
|
ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
|
|
throw error;
|
|
}
|
|
};
|
|
|
|
export default testOpsgenie;
|