fix: format
This commit is contained in:
@@ -3,7 +3,7 @@ import { emptyWorkflow } from "../shared/constants";
|
|||||||
import { default as axios, AxiosResponse } from "axios";
|
import { default as axios, AxiosResponse } from "axios";
|
||||||
import { apiUrl } from "../apiConfig";
|
import { apiUrl } from "../apiConfig";
|
||||||
|
|
||||||
export const getActiveWorkflow = async(id: string) : Promise<WorkflowFile> => {
|
export const getActiveWorkflow = async (id: string): Promise<WorkflowFile> => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`${apiUrl}/workflow/${id}`)
|
const response = await axios.get(`${apiUrl}/workflow/${id}`)
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
@@ -11,13 +11,13 @@ export const getActiveWorkflow = async(id: string) : Promise<WorkflowFile> => {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error('Something went wrong when fetching a recorded workflow');
|
throw new Error('Something went wrong when fetching a recorded workflow');
|
||||||
}
|
}
|
||||||
} catch(error: any) {
|
} catch (error: any) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return emptyWorkflow;
|
return emptyWorkflow;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getParamsOfActiveWorkflow = async(id: string) : Promise<string[]|null> => {
|
export const getParamsOfActiveWorkflow = async (id: string): Promise<string[] | null> => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`${apiUrl}/workflow/params/${id}`)
|
const response = await axios.get(`${apiUrl}/workflow/params/${id}`)
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
@@ -25,15 +25,15 @@ export const getParamsOfActiveWorkflow = async(id: string) : Promise<string[]|nu
|
|||||||
} else {
|
} else {
|
||||||
throw new Error('Something went wrong when fetching the parameters of the recorded workflow');
|
throw new Error('Something went wrong when fetching the parameters of the recorded workflow');
|
||||||
}
|
}
|
||||||
} catch(error: any) {
|
} catch (error: any) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deletePair = async(index: number): Promise<WorkflowFile> => {
|
export const deletePair = async (index: number): Promise<WorkflowFile> => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.delete(`${apiUrl}/workflow/pair/${index}`);
|
const response = await axios.delete(`${apiUrl}/workflow/pair/${index}`);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
return response.data;
|
return response.data;
|
||||||
} else {
|
} else {
|
||||||
@@ -45,11 +45,11 @@ export const deletePair = async(index: number): Promise<WorkflowFile> => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AddPair = async(index: number, pair: WhereWhatPair): Promise<WorkflowFile> => {
|
export const AddPair = async (index: number, pair: WhereWhatPair): Promise<WorkflowFile> => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(`${apiUrl}/workflow/pair/${index}`, {
|
const response = await axios.post(`${apiUrl}/workflow/pair/${index}`, {
|
||||||
pair,
|
pair,
|
||||||
}, {headers: {'Content-Type': 'application/json'}});
|
}, { headers: { 'Content-Type': 'application/json' } });
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
return response.data;
|
return response.data;
|
||||||
} else {
|
} else {
|
||||||
@@ -61,11 +61,11 @@ export const AddPair = async(index: number, pair: WhereWhatPair): Promise<Workfl
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const UpdatePair = async(index: number, pair: WhereWhatPair): Promise<WorkflowFile> => {
|
export const UpdatePair = async (index: number, pair: WhereWhatPair): Promise<WorkflowFile> => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.put(`${apiUrl}/workflow/pair/${index}`, {
|
const response = await axios.put(`${apiUrl}/workflow/pair/${index}`, {
|
||||||
pair,
|
pair,
|
||||||
}, {headers: {'Content-Type': 'application/json'}});
|
}, { headers: { 'Content-Type': 'application/json' } });
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
return response.data;
|
return response.data;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user