Merge branch 'main' into AUT-1380
This commit is contained in:
@@ -13,7 +13,6 @@ import useCreateConnectionAuthUrl from './useCreateConnectionAuthUrl';
|
||||
import useUpdateConnection from './useUpdateConnection';
|
||||
import useResetConnection from './useResetConnection';
|
||||
import useVerifyConnection from './useVerifyConnection';
|
||||
import { useWhatChanged } from '@simbathesailor/use-what-changed';
|
||||
|
||||
function getSteps(auth, hasConnection, useShared) {
|
||||
if (hasConnection) {
|
||||
@@ -143,24 +142,6 @@ export default function useAuthenticateApp(payload) {
|
||||
verifyConnection,
|
||||
]);
|
||||
|
||||
useWhatChanged(
|
||||
[
|
||||
steps,
|
||||
appKey,
|
||||
oauthClientId,
|
||||
connectionId,
|
||||
queryClient,
|
||||
createConnection,
|
||||
createConnectionAuthUrl,
|
||||
updateConnection,
|
||||
resetConnection,
|
||||
verifyConnection,
|
||||
],
|
||||
'steps, appKey, oauthClientId, connectionId, queryClient, createConnection, createConnectionAuthUrl, updateConnection, resetConnection, verifyConnection',
|
||||
'',
|
||||
'useAuthenticate',
|
||||
);
|
||||
|
||||
return {
|
||||
authenticate,
|
||||
inProgress: authenticationInProgress,
|
||||
|
||||
@@ -2,11 +2,11 @@ import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import api from 'helpers/api';
|
||||
|
||||
export default function useDeleteFlow() {
|
||||
export default function useDeleteFlow(flowId) {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const query = useMutation({
|
||||
mutationFn: async (flowId) => {
|
||||
mutationFn: async () => {
|
||||
const { data } = await api.delete(`/v1/flows/${flowId}`);
|
||||
|
||||
return data;
|
||||
|
||||
31
packages/web/src/hooks/useDownloadJsonAsFile.js
Normal file
31
packages/web/src/hooks/useDownloadJsonAsFile.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import * as React from 'react';
|
||||
import slugify from 'slugify';
|
||||
|
||||
export default function useDownloadJsonAsFile() {
|
||||
const handleDownloadJsonAsFile = React.useCallback(
|
||||
function handleDownloadJsonAsFile({ contents, name }) {
|
||||
const stringifiedContents = JSON.stringify(contents, null, 2);
|
||||
|
||||
const slugifiedName = slugify(name, {
|
||||
lower: true,
|
||||
strict: true,
|
||||
replacement: '-',
|
||||
});
|
||||
|
||||
const fileBlob = new Blob([stringifiedContents], {
|
||||
type: 'application/json',
|
||||
});
|
||||
|
||||
const fileObjectUrl = URL.createObjectURL(fileBlob);
|
||||
|
||||
const temporaryDownloadLink = document.createElement('a');
|
||||
temporaryDownloadLink.href = fileObjectUrl;
|
||||
temporaryDownloadLink.download = slugifiedName;
|
||||
|
||||
temporaryDownloadLink.click();
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
return handleDownloadJsonAsFile;
|
||||
}
|
||||
15
packages/web/src/hooks/useExportFlow.js
Normal file
15
packages/web/src/hooks/useExportFlow.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
|
||||
import api from 'helpers/api';
|
||||
|
||||
export default function useExportFlow(flowId) {
|
||||
const mutation = useMutation({
|
||||
mutationFn: async () => {
|
||||
const { data } = await api.post(`/v1/flows/${flowId}/export`);
|
||||
|
||||
return data;
|
||||
},
|
||||
});
|
||||
|
||||
return mutation;
|
||||
}
|
||||
Reference in New Issue
Block a user