refactor(web): remove typescript
This commit is contained in:
@@ -3,47 +3,36 @@ import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||
import { useMutation } from '@apollo/client';
|
||||
import CircularProgress from '@mui/material/CircularProgress';
|
||||
import Typography from '@mui/material/Typography';
|
||||
|
||||
import * as URLS from 'config/urls';
|
||||
import useFormatMessage from 'hooks/useFormatMessage';
|
||||
import { CREATE_FLOW } from 'graphql/mutations/create-flow';
|
||||
|
||||
import Box from '@mui/material/Box';
|
||||
|
||||
export default function CreateFlow(): React.ReactElement {
|
||||
export default function CreateFlow() {
|
||||
const [searchParams] = useSearchParams();
|
||||
const navigate = useNavigate();
|
||||
const formatMessage = useFormatMessage();
|
||||
const [createFlow] = useMutation(CREATE_FLOW);
|
||||
|
||||
const appKey = searchParams.get('appKey');
|
||||
const connectionId = searchParams.get('connectionId');
|
||||
|
||||
React.useEffect(() => {
|
||||
async function initiate() {
|
||||
const variables: { [key: string]: string } = {};
|
||||
|
||||
const variables = {};
|
||||
if (appKey) {
|
||||
variables.triggerAppKey = appKey;
|
||||
}
|
||||
|
||||
if (connectionId) {
|
||||
variables.connectionId = connectionId;
|
||||
}
|
||||
|
||||
const response = await createFlow({
|
||||
variables: {
|
||||
input: variables,
|
||||
},
|
||||
});
|
||||
const flowId = response.data?.createFlow?.id;
|
||||
|
||||
navigate(URLS.FLOW_EDITOR(flowId), { replace: true });
|
||||
}
|
||||
|
||||
initiate();
|
||||
}, [createFlow, navigate, appKey, connectionId]);
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
@@ -1,6 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import EditorLayout from 'components/EditorLayout';
|
||||
|
||||
export default function FlowEditor(): React.ReactElement {
|
||||
export default function FlowEditor() {
|
||||
return <EditorLayout />;
|
||||
}
|
@@ -2,8 +2,7 @@ import * as React from 'react';
|
||||
import { Routes, Route } from 'react-router-dom';
|
||||
import CreateFlowPage from './create';
|
||||
import EditorPage from './index';
|
||||
|
||||
export default function EditorRoutes(): React.ReactElement {
|
||||
export default function EditorRoutes() {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path="/create" element={<CreateFlowPage />} />
|
Reference in New Issue
Block a user