mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-04 16:10:38 +08:00

* fix: 🐛 convert TTL APIs to async * chore: add archive support * chore: update TTL async APIs according to new design * chore: 🔥 clean removeTTL API * fix: metrics s3 config * feat: ttl async with polling (#1195) * feat: ttl state message change and time unit language changes (#1197) * test: ✅ update tests for async TTL api * feat: ttl message info icon (#1202) * feat: ttl pr review changes * chore: refractoring Co-authored-by: makeavish <makeavish786@gmail.com> Co-authored-by: Pranshu Chittora <pranshu@signoz.io> Co-authored-by: palash-signoz <palash@signoz.io> Co-authored-by: Pranay Prateek <pranay@signoz.io>
27 lines
690 B
TypeScript
27 lines
690 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/settings/getRetention';
|
|
|
|
const getRetention = async <T extends Props>(
|
|
props: T,
|
|
): Promise<SuccessResponse<PayloadProps<T>> | ErrorResponse> => {
|
|
try {
|
|
const response = await axios.get<PayloadProps<T>>(
|
|
`/settings/ttl?type=${props}`,
|
|
);
|
|
|
|
return {
|
|
statusCode: 200,
|
|
error: null,
|
|
message: 'Success',
|
|
payload: response.data,
|
|
};
|
|
} catch (error) {
|
|
return ErrorResponseHandler(error as AxiosError);
|
|
}
|
|
};
|
|
|
|
export default getRetention;
|