feat: added handling of using same connection with different projects

This commit is contained in:
Sheen Capadngan
2024-10-15 03:37:11 +08:00
parent faf2c6df90
commit 73382c5363
15 changed files with 287 additions and 38 deletions
@@ -0,0 +1,19 @@
import { useMutation } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
import { IntegrationAuth, TDuplicateIntegrationAuthDTO } from "./types";
// For now, this should only be used in the Github app integration flow.
export const useDuplicateIntegrationAuth = () => {
return useMutation<IntegrationAuth, {}, TDuplicateIntegrationAuthDTO>({
mutationFn: async (body) => {
const { data } = await apiRequest.post<{ integrationAuth: IntegrationAuth }>(
`/api/v1/integration-auth/${body.integrationAuthId}/duplicate`,
body
);
return data.integrationAuth;
}
});
};