1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

add eslint-plugin-prettier

This commit is contained in:
Fedor Katurov 2025-01-24 17:51:59 +07:00
parent 0e4d2bf44d
commit ba0604ab9d
69 changed files with 419 additions and 249 deletions

View file

@ -1,6 +1,11 @@
import { useCallback, useRef } from 'react';
import { FormikConfig, FormikHelpers, useFormik, useFormikContext } from 'formik';
import {
FormikConfig,
FormikHelpers,
useFormik,
useFormikContext,
} from 'formik';
import { object } from 'yup';
import { INode } from '~/types';
@ -10,31 +15,31 @@ import { showErrorToast } from '~/utils/errors/showToast';
const validationSchema = object().shape({});
const afterSubmit = ({ resetForm, setSubmitting, setErrors }: FormikHelpers<INode>) => (
error?: unknown
) => {
setSubmitting(false);
const afterSubmit =
({ resetForm, setSubmitting, setErrors }: FormikHelpers<INode>) =>
(error?: unknown) => {
setSubmitting(false);
if (error) {
showErrorToast(error);
return;
}
if (error) {
showErrorToast(error);
return;
}
if (getValidationErrors(error)) {
setErrors(getValidationErrors(error)!);
return;
}
if (getValidationErrors(error)) {
setErrors(getValidationErrors(error)!);
return;
}
if (resetForm) {
resetForm();
}
};
if (resetForm) {
resetForm();
}
};
export const useNodeFormFormik = (
values: INode,
uploader: Uploader,
stopEditing: () => void,
sendSaveRequest: (node: INode) => Promise<unknown>
sendSaveRequest: (node: INode) => Promise<unknown>,
) => {
const { current: initialValues } = useRef(values);
@ -53,7 +58,7 @@ export const useNodeFormFormik = (
afterSubmit(helpers)(error);
}
},
[sendSaveRequest, uploader.files]
[sendSaveRequest, uploader.files],
);
return useFormik<INode>({