mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 18:15:53 +00:00
feat: slack integration deletion
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
export { useUpdateSlackIntegration } from "./mutation";
|
||||
export { useDeleteSlackIntegration, useUpdateSlackIntegration } from "./mutation";
|
||||
export { fetchSlackInstallUrl, useGetSlackIntegrationByProject } from "./queries";
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
import { slackKeys } from "./queries";
|
||||
import { TUpdateSlackIntegrationDTO } from "./types";
|
||||
import { TDeleteSlackIntegrationDTO, TUpdateSlackIntegrationDTO } from "./types";
|
||||
|
||||
export const useUpdateSlackIntegration = () => {
|
||||
const queryClient = useQueryClient();
|
||||
@@ -19,3 +19,18 @@ export const useUpdateSlackIntegration = () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const useDeleteSlackIntegration = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation<{}, {}, TDeleteSlackIntegrationDTO>({
|
||||
mutationFn: async (dto) => {
|
||||
const { data } = await apiRequest.delete(`/api/v1/slack/${dto.id}`);
|
||||
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { workspaceId }) => {
|
||||
queryClient.invalidateQueries(slackKeys.getSlackIntegrationByProject(workspaceId));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -15,3 +15,8 @@ export type TUpdateSlackIntegrationDTO = {
|
||||
isSecretRequestNotificationEnabled?: boolean;
|
||||
secretRequestChannels?: string;
|
||||
};
|
||||
|
||||
export type TDeleteSlackIntegrationDTO = {
|
||||
id: string;
|
||||
workspaceId: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user