2022-04-22 20:03:08 +05:30
|
|
|
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/errors/getAll';
|
|
|
|
|
|
|
|
|
|
const getAll = async (
|
|
|
|
|
props: Props,
|
|
|
|
|
): Promise<SuccessResponse<PayloadProps> | ErrorResponse> => {
|
|
|
|
|
try {
|
2023-03-29 14:45:58 +05:30
|
|
|
const response = await axios.post(`/listErrors`, {
|
|
|
|
|
start: `${props.start}`,
|
|
|
|
|
end: `${props.end}`,
|
|
|
|
|
order: props.order,
|
|
|
|
|
orderParam: props.orderParam,
|
|
|
|
|
limit: props.limit,
|
|
|
|
|
offset: props.offset,
|
|
|
|
|
exceptionType: props.exceptionType,
|
|
|
|
|
serviceName: props.serviceName,
|
|
|
|
|
tags: props.tags,
|
|
|
|
|
});
|
2022-04-22 20:03:08 +05:30
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
statusCode: 200,
|
|
|
|
|
error: null,
|
2022-05-05 16:16:13 +05:30
|
|
|
message: 'Success',
|
2022-04-22 20:03:08 +05:30
|
|
|
payload: response.data,
|
|
|
|
|
};
|
|
|
|
|
} catch (error) {
|
|
|
|
|
return ErrorResponseHandler(error as AxiosError);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default getAll;
|