mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-27 07:02:03 +08:00

* chore(dashboard): intial commit * chore(dashboard): bring all the code in module * chore(dashboard): remove lock unlock from ee codebase * chore(dashboard): go deps * chore(dashboard): fix lint * chore(dashboard): implement the store * chore(dashboard): add migration * chore(dashboard): fix lint * chore(dashboard): api and frontend changes * chore(dashboard): frontend changes for new dashboards * chore(dashboard): fix test cases * chore(dashboard): add lock unlock APIs * chore(dashboard): add lock unlock APIs * chore(dashboard): move integrations controller out from module * chore(dashboard): move integrations controller out from module * chore(dashboard): move integrations controller out from module * chore(dashboard): rename migration file * chore(dashboard): surface errors for lock/unlock dashboard * chore(dashboard): some testing cleanups * chore(dashboard): fix postgres migrations --------- Co-authored-by: Vibhu Pandey <vibhupandey28@gmail.com>
24 lines
737 B
TypeScript
24 lines
737 B
TypeScript
import deleteDashboard from 'api/v1/dashboards/id/delete';
|
|
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
|
import { useErrorModal } from 'providers/ErrorModalProvider';
|
|
import { useMutation, UseMutationResult } from 'react-query';
|
|
import { SuccessResponseV2 } from 'types/api';
|
|
import APIError from 'types/api/error';
|
|
|
|
export const useDeleteDashboard = (
|
|
id: string,
|
|
): UseMutationResult<SuccessResponseV2<null>, APIError, void, unknown> => {
|
|
const { showErrorModal } = useErrorModal();
|
|
|
|
return useMutation<SuccessResponseV2<null>, APIError>({
|
|
mutationKey: REACT_QUERY_KEY.DELETE_DASHBOARD,
|
|
mutationFn: () =>
|
|
deleteDashboard({
|
|
id,
|
|
}),
|
|
onError: (error: APIError) => {
|
|
showErrorModal(error);
|
|
},
|
|
});
|
|
};
|