chore: suit eslint rules

This commit is contained in:
Ali BARIN
2022-01-16 19:47:16 +01:00
parent f6d7971b4f
commit c09a535653
73 changed files with 1197 additions and 2549 deletions

View File

@@ -7,7 +7,14 @@ enum AuthenticationSteps {
OpenWithPopup = 'openWithPopup',
}
const processMutation = async (step: any, variables: any) => {
type Step = {
name: string;
variables: Record<string, unknown>;
process: (step: any, variables: Record<string, unknown>) => Promise<any>;
type: AuthenticationSteps.Mutation | AuthenticationSteps.OpenWithPopup;
};
const processMutation = async (step: Step, variables: Record<string, unknown>) => {
const mutation = MUTATIONS[step.name];
const mutationResponse = await apolloClient.mutate({ mutation, variables });
const responseData = mutationResponse.data[step.name];
@@ -31,8 +38,8 @@ function getObjectOfEntries(iterator: any) {
return result;
}
const processOpenWithPopup = (step: any, variables: any) => {
return new Promise((resolve, reject) => {
const processOpenWithPopup = (step: Step, variables: Record<string, string>) => {
return new Promise((resolve) => {
const windowFeatures = 'toolbar=no, menubar=no, width=600, height=700, top=100, left=100';
const url = variables.url;
@@ -55,16 +62,10 @@ const processOpenWithPopup = (step: any, variables: any) => {
});
};
export const processStep = (step: any, variables: any) => {
return new Promise(async (resolve, reject) => {
let response;
if (step.type === AuthenticationSteps.Mutation) {
response = await processMutation(step, variables);
} else if (step.type === AuthenticationSteps.OpenWithPopup) {
response = await processOpenWithPopup(step, variables);
}
resolve(response);
});
export const processStep = async (step: Step, variables: Record<string, string>): Promise<any> => {
if (step.type === AuthenticationSteps.Mutation) {
return processMutation(step, variables);
} else if (step.type === AuthenticationSteps.OpenWithPopup) {
return processOpenWithPopup(step, variables);
}
};

View File

@@ -2,12 +2,23 @@ import template from 'lodash.template';
const interpolate = /{([\s\S]+?)}/g;
type VARIABLES = {
type Variables = {
[key: string]: any
}
const computeAuthStepVariables = (variableSchema: any, aggregatedData: any) => {
const variables: VARIABLES = {};
type VariableSchema = {
properties: VariableSchema[];
name: string;
type: 'string' | 'integer';
value: string;
}
type AggregatedData = {
[key: string]: Record<string, unknown> | string;
}
const computeAuthStepVariables = (variableSchema: VariableSchema[], aggregatedData: AggregatedData): Variables => {
const variables: Variables = {};
for (const variable of variableSchema) {
if (variable.properties) {

View File

@@ -1,4 +1,5 @@
import copy from 'clipboard-copy';
export default function copyInputValue(element: HTMLInputElement) {
export default function copyInputValue(element: HTMLInputElement): void {
copy(element.value);
};