mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
|
|
import { apiRequest } from "@app/config/request";
|
|
|
|
import { githubOrgSyncConfigQueryKeys } from "./queries";
|
|
import { TCreateGithubOrgSyncDTO, TUpdateGithubOrgSyncDTO } from "./types";
|
|
|
|
export const useCreateGithubSyncOrgConfig = () => {
|
|
const queryClient = useQueryClient();
|
|
return useMutation({
|
|
mutationFn: (dto: TCreateGithubOrgSyncDTO) => {
|
|
return apiRequest.post("/api/v1/github-org-sync-config", dto);
|
|
},
|
|
onSuccess: () => {
|
|
queryClient.invalidateQueries(githubOrgSyncConfigQueryKeys.get());
|
|
}
|
|
});
|
|
};
|
|
|
|
export const useUpdateGithubSyncOrgConfig = () => {
|
|
const queryClient = useQueryClient();
|
|
return useMutation({
|
|
mutationFn: (dto: TUpdateGithubOrgSyncDTO) => {
|
|
return apiRequest.patch("/api/v1/github-org-sync-config", dto);
|
|
},
|
|
onSuccess: () => {
|
|
queryClient.invalidateQueries(githubOrgSyncConfigQueryKeys.get());
|
|
}
|
|
});
|
|
};
|
|
|
|
export const useDeleteGithubSyncOrgConfig = () => {
|
|
const queryClient = useQueryClient();
|
|
return useMutation({
|
|
mutationFn: () => {
|
|
return apiRequest.delete("/api/v1/github-org-sync-config");
|
|
},
|
|
onSuccess: () => {
|
|
queryClient.invalidateQueries(githubOrgSyncConfigQueryKeys.get());
|
|
}
|
|
});
|
|
};
|