mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-06-21 00:37:58 +08:00

* added more changes to query builder * added types for composite queries * (feat): added edit rules and create rules forms * (feat): added chart preview for alert metric ui * (feat): added threshold in chart, translations in alert form and a few fixes * feat: added a link for alert name in list alerts page and source for each rule update Co-authored-by: Pranshu Chittora <pranshu@signoz.io>
27 lines
650 B
TypeScript
27 lines
650 B
TypeScript
import axios from 'api';
|
|
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
|
|
import { AxiosError } from 'axios';
|
|
import { ErrorResponse, SuccessResponse } from 'types/api';
|
|
import { PayloadProps, Props } from 'types/api/alerts/create';
|
|
|
|
const create = async (
|
|
props: Props,
|
|
): Promise<SuccessResponse<PayloadProps> | ErrorResponse> => {
|
|
try {
|
|
const response = await axios.post('/rules', {
|
|
...props.data,
|
|
});
|
|
|
|
return {
|
|
statusCode: 200,
|
|
error: null,
|
|
message: response.data.status,
|
|
payload: response.data.data,
|
|
};
|
|
} catch (error) {
|
|
return ErrorResponseHandler(error as AxiosError);
|
|
}
|
|
};
|
|
|
|
export default create;
|