mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 04:50:36 +03:00
F: Rework zod schema names and DeleteOperation dialog
This commit is contained in:
parent
c5bf72f889
commit
a967e957b3
|
@ -55,7 +55,7 @@ export function ModalForm({
|
||||||
header,
|
header,
|
||||||
overflowVisible,
|
overflowVisible,
|
||||||
|
|
||||||
canSubmit,
|
canSubmit = true,
|
||||||
submitText = 'Продолжить',
|
submitText = 'Продолжить',
|
||||||
submitInvalidTooltip,
|
submitInvalidTooltip,
|
||||||
beforeSubmit,
|
beforeSubmit,
|
||||||
|
|
|
@ -20,7 +20,7 @@ export interface ICurrentUser {
|
||||||
/**
|
/**
|
||||||
* Represents login data, used to authenticate users.
|
* Represents login data, used to authenticate users.
|
||||||
*/
|
*/
|
||||||
export const UserLoginSchema = z.object({
|
export const schemaUserLogin = z.object({
|
||||||
username: z.string().nonempty(errors.requiredField),
|
username: z.string().nonempty(errors.requiredField),
|
||||||
password: z.string().nonempty(errors.requiredField)
|
password: z.string().nonempty(errors.requiredField)
|
||||||
});
|
});
|
||||||
|
@ -28,12 +28,12 @@ export const UserLoginSchema = z.object({
|
||||||
/**
|
/**
|
||||||
* Represents login data, used to authenticate users.
|
* Represents login data, used to authenticate users.
|
||||||
*/
|
*/
|
||||||
export type IUserLoginDTO = z.infer<typeof UserLoginSchema>;
|
export type IUserLoginDTO = z.infer<typeof schemaUserLogin>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents data needed to update password for current user.
|
* Represents data needed to update password for current user.
|
||||||
*/
|
*/
|
||||||
export const ChangePasswordSchema = z
|
export const schemaChangePassword = z
|
||||||
.object({
|
.object({
|
||||||
old_password: z.string().nonempty(errors.requiredField),
|
old_password: z.string().nonempty(errors.requiredField),
|
||||||
new_password: z.string().nonempty(errors.requiredField),
|
new_password: z.string().nonempty(errors.requiredField),
|
||||||
|
@ -51,7 +51,7 @@ export const ChangePasswordSchema = z
|
||||||
/**
|
/**
|
||||||
* Represents data needed to update password for current user.
|
* Represents data needed to update password for current user.
|
||||||
*/
|
*/
|
||||||
export type IChangePasswordDTO = z.infer<typeof ChangePasswordSchema>;
|
export type IChangePasswordDTO = z.infer<typeof schemaChangePassword>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents password reset request data.
|
* Represents password reset request data.
|
||||||
|
|
|
@ -12,7 +12,7 @@ import { TextInput } from '@/components/Input';
|
||||||
import useQueryStrings from '@/hooks/useQueryStrings';
|
import useQueryStrings from '@/hooks/useQueryStrings';
|
||||||
import { resources } from '@/utils/constants';
|
import { resources } from '@/utils/constants';
|
||||||
|
|
||||||
import { IUserLoginDTO, UserLoginSchema } from '../backend/api';
|
import { IUserLoginDTO, schemaUserLogin } from '../backend/api';
|
||||||
import { useAuthSuspense } from '../backend/useAuth';
|
import { useAuthSuspense } from '../backend/useAuth';
|
||||||
import { useLogin } from '../backend/useLogin';
|
import { useLogin } from '../backend/useLogin';
|
||||||
import ExpectedAnonymous from '../components/ExpectedAnonymous';
|
import ExpectedAnonymous from '../components/ExpectedAnonymous';
|
||||||
|
@ -29,7 +29,7 @@ function LoginPage() {
|
||||||
resetField,
|
resetField,
|
||||||
formState: { errors }
|
formState: { errors }
|
||||||
} = useForm({
|
} = useForm({
|
||||||
resolver: zodResolver(UserLoginSchema),
|
resolver: zodResolver(schemaUserLogin),
|
||||||
defaultValues: { username: initialName, password: '' }
|
defaultValues: { username: initialName, password: '' }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ export interface IRenameLocationDTO {
|
||||||
/**
|
/**
|
||||||
* Represents data, used for cloning {@link IRSForm}.
|
* Represents data, used for cloning {@link IRSForm}.
|
||||||
*/
|
*/
|
||||||
export const CloneLibraryItemSchema = z.object({
|
export const schemaCloneLibraryItem = z.object({
|
||||||
id: z.number(),
|
id: z.number(),
|
||||||
item_type: z.nativeEnum(LibraryItemType),
|
item_type: z.nativeEnum(LibraryItemType),
|
||||||
title: z.string().nonempty(errors.requiredField),
|
title: z.string().nonempty(errors.requiredField),
|
||||||
|
@ -39,12 +39,12 @@ export const CloneLibraryItemSchema = z.object({
|
||||||
/**
|
/**
|
||||||
* Represents data, used for cloning {@link IRSForm}.
|
* Represents data, used for cloning {@link IRSForm}.
|
||||||
*/
|
*/
|
||||||
export type ICloneLibraryItemDTO = z.infer<typeof CloneLibraryItemSchema>;
|
export type ICloneLibraryItemDTO = z.infer<typeof schemaCloneLibraryItem>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents data, used for creating {@link IRSForm}.
|
* Represents data, used for creating {@link IRSForm}.
|
||||||
*/
|
*/
|
||||||
export const CreateLibraryItemSchema = z
|
export const schemaCreateLibraryItem = z
|
||||||
.object({
|
.object({
|
||||||
item_type: z.nativeEnum(LibraryItemType),
|
item_type: z.nativeEnum(LibraryItemType),
|
||||||
title: z.string().optional(),
|
title: z.string().optional(),
|
||||||
|
@ -70,12 +70,12 @@ export const CreateLibraryItemSchema = z
|
||||||
/**
|
/**
|
||||||
* Represents data, used for creating {@link IRSForm}.
|
* Represents data, used for creating {@link IRSForm}.
|
||||||
*/
|
*/
|
||||||
export type ICreateLibraryItemDTO = z.infer<typeof CreateLibraryItemSchema>;
|
export type ICreateLibraryItemDTO = z.infer<typeof schemaCreateLibraryItem>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents update data for editing {@link ILibraryItem}.
|
* Represents update data for editing {@link ILibraryItem}.
|
||||||
*/
|
*/
|
||||||
export const UpdateLibraryItemSchema = z.object({
|
export const schemaUpdateLibraryItem = z.object({
|
||||||
id: z.number(),
|
id: z.number(),
|
||||||
item_type: z.nativeEnum(LibraryItemType),
|
item_type: z.nativeEnum(LibraryItemType),
|
||||||
title: z.string().nonempty(errors.requiredField),
|
title: z.string().nonempty(errors.requiredField),
|
||||||
|
@ -88,12 +88,12 @@ export const UpdateLibraryItemSchema = z.object({
|
||||||
/**
|
/**
|
||||||
* Represents update data for editing {@link ILibraryItem}.
|
* Represents update data for editing {@link ILibraryItem}.
|
||||||
*/
|
*/
|
||||||
export type IUpdateLibraryItemDTO = z.infer<typeof UpdateLibraryItemSchema>;
|
export type IUpdateLibraryItemDTO = z.infer<typeof schemaUpdateLibraryItem>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create version metadata in persistent storage.
|
* Create version metadata in persistent storage.
|
||||||
*/
|
*/
|
||||||
export const VersionCreateSchema = z.object({
|
export const schemaVersionCreate = z.object({
|
||||||
version: z.string(),
|
version: z.string(),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
items: z.array(z.number()).optional()
|
items: z.array(z.number()).optional()
|
||||||
|
@ -102,7 +102,7 @@ export const VersionCreateSchema = z.object({
|
||||||
/**
|
/**
|
||||||
* Create version metadata in persistent storage.
|
* Create version metadata in persistent storage.
|
||||||
*/
|
*/
|
||||||
export type IVersionCreateDTO = z.infer<typeof VersionCreateSchema>;
|
export type IVersionCreateDTO = z.infer<typeof schemaVersionCreate>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents data response when creating {@link IVersionInfo}.
|
* Represents data response when creating {@link IVersionInfo}.
|
||||||
|
@ -115,7 +115,7 @@ export interface IVersionCreatedResponse {
|
||||||
/**
|
/**
|
||||||
* Represents version data, intended to update version metadata in persistent storage.
|
* Represents version data, intended to update version metadata in persistent storage.
|
||||||
*/
|
*/
|
||||||
export const VersionUpdateSchema = z.object({
|
export const schemaVersionUpdate = z.object({
|
||||||
id: z.number(),
|
id: z.number(),
|
||||||
version: z.string().nonempty(errors.requiredField),
|
version: z.string().nonempty(errors.requiredField),
|
||||||
description: z.string()
|
description: z.string()
|
||||||
|
@ -124,7 +124,7 @@ export const VersionUpdateSchema = z.object({
|
||||||
/**
|
/**
|
||||||
* Represents version data, intended to update version metadata in persistent storage.
|
* Represents version data, intended to update version metadata in persistent storage.
|
||||||
*/
|
*/
|
||||||
export type IVersionUpdateDTO = z.infer<typeof VersionUpdateSchema>;
|
export type IVersionUpdateDTO = z.infer<typeof schemaVersionUpdate>;
|
||||||
|
|
||||||
export const libraryApi = {
|
export const libraryApi = {
|
||||||
baseKey: 'library',
|
baseKey: 'library',
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { Label, TextArea, TextInput } from '@/components/Input';
|
||||||
import { useAuthSuspense } from '@/features/auth/backend/useAuth';
|
import { useAuthSuspense } from '@/features/auth/backend/useAuth';
|
||||||
import { EXTEOR_TRS_FILE } from '@/utils/constants';
|
import { EXTEOR_TRS_FILE } from '@/utils/constants';
|
||||||
|
|
||||||
import { CreateLibraryItemSchema, ICreateLibraryItemDTO } from '../../backend/api';
|
import { schemaCreateLibraryItem, ICreateLibraryItemDTO } from '../../backend/api';
|
||||||
import { useCreateItem } from '../../backend/useCreateItem';
|
import { useCreateItem } from '../../backend/useCreateItem';
|
||||||
import SelectAccessPolicy from '../../components/SelectAccessPolicy';
|
import SelectAccessPolicy from '../../components/SelectAccessPolicy';
|
||||||
import SelectItemType from '../../components/SelectItemType';
|
import SelectItemType from '../../components/SelectItemType';
|
||||||
|
@ -41,7 +41,7 @@ function FormCreateItem() {
|
||||||
control,
|
control,
|
||||||
formState: { errors }
|
formState: { errors }
|
||||||
} = useForm<ICreateLibraryItemDTO>({
|
} = useForm<ICreateLibraryItemDTO>({
|
||||||
resolver: zodResolver(CreateLibraryItemSchema),
|
resolver: zodResolver(schemaCreateLibraryItem),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
item_type: LibraryItemType.RSFORM,
|
item_type: LibraryItemType.RSFORM,
|
||||||
access_policy: AccessPolicy.PUBLIC,
|
access_policy: AccessPolicy.PUBLIC,
|
||||||
|
|
|
@ -29,6 +29,20 @@ export interface IOperationSchemaDTO extends ILibraryItemData {
|
||||||
substitutions: ICstSubstituteEx[];
|
substitutions: ICstSubstituteEx[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents {@link IOperation} position.
|
||||||
|
*/
|
||||||
|
export const schemaOperationPosition = z.object({
|
||||||
|
id: z.number(),
|
||||||
|
position_x: z.number(),
|
||||||
|
position_y: z.number()
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents {@link IOperation} position.
|
||||||
|
*/
|
||||||
|
export type IOperationPosition = z.infer<typeof schemaOperationPosition>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents {@link IOperation} data, used in creation process.
|
* Represents {@link IOperation} data, used in creation process.
|
||||||
*/
|
*/
|
||||||
|
@ -66,10 +80,17 @@ export interface ITargetOperation {
|
||||||
/**
|
/**
|
||||||
* Represents {@link IOperation} data, used in destruction process.
|
* Represents {@link IOperation} data, used in destruction process.
|
||||||
*/
|
*/
|
||||||
export interface IOperationDeleteDTO extends ITargetOperation {
|
export const schemaOperationDelete = z.object({
|
||||||
keep_constituents: boolean;
|
target: z.number(),
|
||||||
delete_schema: boolean;
|
positions: z.array(schemaOperationPosition),
|
||||||
}
|
keep_constituents: z.boolean(),
|
||||||
|
delete_schema: z.boolean()
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents {@link IOperation} data, used in destruction process.
|
||||||
|
*/
|
||||||
|
export type IOperationDeleteDTO = z.infer<typeof schemaOperationDelete>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents data response when creating {@link IRSForm} for Input {@link IOperation}.
|
* Represents data response when creating {@link IRSForm} for Input {@link IOperation}.
|
||||||
|
@ -79,33 +100,19 @@ export interface IInputCreatedResponse {
|
||||||
oss: IOperationSchemaDTO;
|
oss: IOperationSchemaDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents {@link IOperation} position.
|
|
||||||
*/
|
|
||||||
export const OperationPositionSchema = z.object({
|
|
||||||
id: z.number(),
|
|
||||||
position_x: z.number(),
|
|
||||||
position_y: z.number()
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents {@link IOperation} position.
|
|
||||||
*/
|
|
||||||
export type IOperationPosition = z.infer<typeof OperationPositionSchema>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents {@link IOperation} data, used in setInput process.
|
* Represents {@link IOperation} data, used in setInput process.
|
||||||
*/
|
*/
|
||||||
export const InputUpdateSchema = z.object({
|
export const schemaInputUpdate = z.object({
|
||||||
target: z.number(),
|
target: z.number(),
|
||||||
positions: z.array(OperationPositionSchema),
|
positions: z.array(schemaOperationPosition),
|
||||||
input: z.number().nullable()
|
input: z.number().nullable()
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents {@link IOperation} data, used in setInput process.
|
* Represents {@link IOperation} data, used in setInput process.
|
||||||
*/
|
*/
|
||||||
export type IInputUpdateDTO = z.infer<typeof InputUpdateSchema>;
|
export type IInputUpdateDTO = z.infer<typeof schemaInputUpdate>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents {@link IOperation} data, used in update process.
|
* Represents {@link IOperation} data, used in update process.
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { ILibraryItem, LibraryItemType } from '@/features/library/models/library
|
||||||
import PickSchema from '@/features/rsform/components/PickSchema';
|
import PickSchema from '@/features/rsform/components/PickSchema';
|
||||||
import { useDialogsStore } from '@/stores/dialogs';
|
import { useDialogsStore } from '@/stores/dialogs';
|
||||||
|
|
||||||
import { IInputUpdateDTO, InputUpdateSchema, IOperationPosition } from '../backend/api';
|
import { IInputUpdateDTO, IOperationPosition, schemaInputUpdate } from '../backend/api';
|
||||||
import { useInputUpdate } from '../backend/useInputUpdate';
|
import { useInputUpdate } from '../backend/useInputUpdate';
|
||||||
import { IOperation, IOperationSchema } from '../models/oss';
|
import { IOperation, IOperationSchema } from '../models/oss';
|
||||||
import { sortItemsForOSS } from '../models/ossAPI';
|
import { sortItemsForOSS } from '../models/ossAPI';
|
||||||
|
@ -29,7 +29,7 @@ function DlgChangeInputSchema() {
|
||||||
const { inputUpdate } = useInputUpdate();
|
const { inputUpdate } = useInputUpdate();
|
||||||
|
|
||||||
const { setValue, handleSubmit, control } = useForm<IInputUpdateDTO>({
|
const { setValue, handleSubmit, control } = useForm<IInputUpdateDTO>({
|
||||||
resolver: zodResolver(InputUpdateSchema),
|
resolver: zodResolver(schemaInputUpdate),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
target: target.id,
|
target: target.id,
|
||||||
positions: positions,
|
positions: positions,
|
||||||
|
|
|
@ -1,27 +1,40 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { useState } from 'react';
|
import { Controller, useForm } from 'react-hook-form';
|
||||||
|
|
||||||
import { Checkbox, TextInput } from '@/components/Input';
|
import { Checkbox, TextInput } from '@/components/Input';
|
||||||
import { ModalForm } from '@/components/Modal';
|
import { ModalForm } from '@/components/Modal';
|
||||||
import { HelpTopic } from '@/features/help/models/helpTopic';
|
import { HelpTopic } from '@/features/help/models/helpTopic';
|
||||||
import { IOperation, OperationID } from '@/features/oss/models/oss';
|
import { IOperation, IOperationSchema } from '@/features/oss/models/oss';
|
||||||
import { useDialogsStore } from '@/stores/dialogs';
|
import { useDialogsStore } from '@/stores/dialogs';
|
||||||
|
|
||||||
|
import { IOperationDeleteDTO, IOperationPosition, schemaOperationDelete } from '../backend/api';
|
||||||
|
import { useOperationDelete } from '../backend/useOperationDelete';
|
||||||
|
|
||||||
export interface DlgDeleteOperationProps {
|
export interface DlgDeleteOperationProps {
|
||||||
|
oss: IOperationSchema;
|
||||||
target: IOperation;
|
target: IOperation;
|
||||||
onSubmit: (targetID: OperationID, keepConstituents: boolean, deleteSchema: boolean) => void;
|
positions: IOperationPosition[];
|
||||||
}
|
}
|
||||||
|
|
||||||
function DlgDeleteOperation() {
|
function DlgDeleteOperation() {
|
||||||
const { target, onSubmit } = useDialogsStore(state => state.props as DlgDeleteOperationProps);
|
const { oss, target, positions } = useDialogsStore(state => state.props as DlgDeleteOperationProps);
|
||||||
const [keepConstituents, setKeepConstituents] = useState(false);
|
const { operationDelete } = useOperationDelete();
|
||||||
const [deleteSchema, setDeleteSchema] = useState(false);
|
|
||||||
|
|
||||||
function handleSubmit() {
|
const { handleSubmit, control } = useForm<IOperationDeleteDTO>({
|
||||||
onSubmit(target.id, keepConstituents, deleteSchema);
|
resolver: zodResolver(schemaOperationDelete),
|
||||||
return true;
|
defaultValues: {
|
||||||
|
target: target.id,
|
||||||
|
positions: positions,
|
||||||
|
keep_constituents: false,
|
||||||
|
delete_schema: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function onSubmit(data: IOperationDeleteDTO) {
|
||||||
|
operationDelete({ itemID: oss.id, data: data });
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -29,19 +42,29 @@ function DlgDeleteOperation() {
|
||||||
overflowVisible
|
overflowVisible
|
||||||
header='Удаление операции'
|
header='Удаление операции'
|
||||||
submitText='Подтвердить удаление'
|
submitText='Подтвердить удаление'
|
||||||
canSubmit={true}
|
onSubmit={event => void handleSubmit(onSubmit)(event)}
|
||||||
onSubmit={handleSubmit}
|
|
||||||
className={clsx('w-[35rem]', 'pb-3 px-6 cc-column', 'select-none')}
|
className={clsx('w-[35rem]', 'pb-3 px-6 cc-column', 'select-none')}
|
||||||
helpTopic={HelpTopic.CC_PROPAGATION}
|
helpTopic={HelpTopic.CC_PROPAGATION}
|
||||||
>
|
>
|
||||||
<TextInput disabled dense noBorder id='operation_alias' label='Операция' value={target.alias} />
|
<TextInput disabled dense noBorder id='operation_alias' label='Операция' value={target.alias} />
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name='keep_constituents'
|
||||||
|
render={({ field }) => (
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label='Сохранить наследованные конституенты'
|
label='Сохранить наследованные конституенты'
|
||||||
titleHtml='Наследованные конституенты <br/>превратятся в дописанные'
|
titleHtml='Наследованные конституенты <br/>превратятся в дописанные'
|
||||||
value={keepConstituents}
|
value={field.value}
|
||||||
onChange={setKeepConstituents}
|
onChange={field.onChange}
|
||||||
disabled={target.result === null}
|
disabled={target.result === null}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name='delete_schema'
|
||||||
|
render={({ field }) => (
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label='Удалить схему'
|
label='Удалить схему'
|
||||||
titleHtml={
|
titleHtml={
|
||||||
|
@ -49,10 +72,12 @@ function DlgDeleteOperation() {
|
||||||
? 'Привязанную схему нельзя удалить'
|
? 'Привязанную схему нельзя удалить'
|
||||||
: 'Удалить схему вместе с операцией'
|
: 'Удалить схему вместе с операцией'
|
||||||
}
|
}
|
||||||
value={deleteSchema}
|
value={field.value}
|
||||||
onChange={setDeleteSchema}
|
onChange={field.onChange}
|
||||||
disabled={!target.is_owned || target.result === null}
|
disabled={!target.is_owned || target.result === null}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
</ModalForm>
|
</ModalForm>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { useForm, useWatch } from 'react-hook-form';
|
||||||
import { SubmitButton } from '@/components/Control';
|
import { SubmitButton } from '@/components/Control';
|
||||||
import { IconSave } from '@/components/Icons';
|
import { IconSave } from '@/components/Icons';
|
||||||
import { TextArea, TextInput } from '@/components/Input';
|
import { TextArea, TextInput } from '@/components/Input';
|
||||||
import { IUpdateLibraryItemDTO, UpdateLibraryItemSchema } from '@/features/library/backend/api';
|
import { IUpdateLibraryItemDTO, schemaUpdateLibraryItem } from '@/features/library/backend/api';
|
||||||
import { useUpdateItem } from '@/features/library/backend/useUpdateItem';
|
import { useUpdateItem } from '@/features/library/backend/useUpdateItem';
|
||||||
import { LibraryItemType } from '@/features/library/models/library';
|
import { LibraryItemType } from '@/features/library/models/library';
|
||||||
import ToolbarItemAccess from '@/features/rsform/pages/RSFormPage/EditorRSFormCard/ToolbarItemAccess';
|
import ToolbarItemAccess from '@/features/rsform/pages/RSFormPage/EditorRSFormCard/ToolbarItemAccess';
|
||||||
|
@ -33,7 +33,7 @@ function FormOSS() {
|
||||||
reset,
|
reset,
|
||||||
formState: { isDirty, errors }
|
formState: { isDirty, errors }
|
||||||
} = useForm<IUpdateLibraryItemDTO>({
|
} = useForm<IUpdateLibraryItemDTO>({
|
||||||
resolver: zodResolver(UpdateLibraryItemSchema),
|
resolver: zodResolver(schemaUpdateLibraryItem),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
id: controller.schema.id,
|
id: controller.schema.id,
|
||||||
item_type: LibraryItemType.RSFORM,
|
item_type: LibraryItemType.RSFORM,
|
||||||
|
|
|
@ -17,7 +17,6 @@ import { prompts } from '@/utils/labels';
|
||||||
|
|
||||||
import { IOperationPosition } from '../../backend/api';
|
import { IOperationPosition } from '../../backend/api';
|
||||||
import { useOperationCreate } from '../../backend/useOperationCreate';
|
import { useOperationCreate } from '../../backend/useOperationCreate';
|
||||||
import { useOperationDelete } from '../../backend/useOperationDelete';
|
|
||||||
import { useOperationUpdate } from '../../backend/useOperationUpdate';
|
import { useOperationUpdate } from '../../backend/useOperationUpdate';
|
||||||
import { useOssSuspense } from '../../backend/useOSS';
|
import { useOssSuspense } from '../../backend/useOSS';
|
||||||
import { useRelocateConstituents } from '../../backend/useRelocateConstituents';
|
import { useRelocateConstituents } from '../../backend/useRelocateConstituents';
|
||||||
|
@ -103,7 +102,6 @@ export const OssEditState = ({ itemID, children }: React.PropsWithChildren<OssEd
|
||||||
const { deleteItem } = useDeleteItem();
|
const { deleteItem } = useDeleteItem();
|
||||||
const { updatePositions } = useUpdatePositions();
|
const { updatePositions } = useUpdatePositions();
|
||||||
const { operationCreate } = useOperationCreate();
|
const { operationCreate } = useOperationCreate();
|
||||||
const { operationDelete } = useOperationDelete();
|
|
||||||
const { operationUpdate } = useOperationUpdate();
|
const { operationUpdate } = useOperationUpdate();
|
||||||
const { relocateConstituents } = useRelocateConstituents();
|
const { relocateConstituents } = useRelocateConstituents();
|
||||||
|
|
||||||
|
@ -199,18 +197,9 @@ export const OssEditState = ({ itemID, children }: React.PropsWithChildren<OssEd
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showDeleteOperation({
|
showDeleteOperation({
|
||||||
target: operation,
|
oss: schema,
|
||||||
onSubmit: (targetID, keepConstituents, deleteSchema) => {
|
|
||||||
operationDelete({
|
|
||||||
itemID: schema.id,
|
|
||||||
data: {
|
|
||||||
target: targetID,
|
|
||||||
positions: positions,
|
positions: positions,
|
||||||
keep_constituents: keepConstituents,
|
target: operation
|
||||||
delete_schema: deleteSchema
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ export interface ICstCreatedResponse {
|
||||||
/**
|
/**
|
||||||
* Represents data, used in updating persistent attributes in {@link IConstituenta}.
|
* Represents data, used in updating persistent attributes in {@link IConstituenta}.
|
||||||
*/
|
*/
|
||||||
export const CstUpdateSchema = z.object({
|
export const schemaCstUpdate = z.object({
|
||||||
target: z.number(),
|
target: z.number(),
|
||||||
item_data: z.object({
|
item_data: z.object({
|
||||||
convention: z.string().optional(),
|
convention: z.string().optional(),
|
||||||
|
@ -95,12 +95,12 @@ export const CstUpdateSchema = z.object({
|
||||||
/**
|
/**
|
||||||
* Represents data, used in updating persistent attributes in {@link IConstituenta}.
|
* Represents data, used in updating persistent attributes in {@link IConstituenta}.
|
||||||
*/
|
*/
|
||||||
export type ICstUpdateDTO = z.infer<typeof CstUpdateSchema>;
|
export type ICstUpdateDTO = z.infer<typeof schemaCstUpdate>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents data, used in renaming {@link IConstituenta}.
|
* Represents data, used in renaming {@link IConstituenta}.
|
||||||
*/
|
*/
|
||||||
export const CstRenameSchema = z.object({
|
export const schemaCstRename = z.object({
|
||||||
target: z.number(),
|
target: z.number(),
|
||||||
alias: z.string(),
|
alias: z.string(),
|
||||||
cst_type: z.nativeEnum(CstType)
|
cst_type: z.nativeEnum(CstType)
|
||||||
|
@ -109,7 +109,7 @@ export const CstRenameSchema = z.object({
|
||||||
/**
|
/**
|
||||||
* Represents data, used in renaming {@link IConstituenta}.
|
* Represents data, used in renaming {@link IConstituenta}.
|
||||||
*/
|
*/
|
||||||
export type ICstRenameDTO = z.infer<typeof CstRenameSchema>;
|
export type ICstRenameDTO = z.infer<typeof schemaCstRename>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents data, used in ordering a list of {@link IConstituenta}.
|
* Represents data, used in ordering a list of {@link IConstituenta}.
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { VisibilityIcon } from '@/components/DomainIcons';
|
||||||
import { Checkbox, Label, TextArea, TextInput } from '@/components/Input';
|
import { Checkbox, Label, TextArea, TextInput } from '@/components/Input';
|
||||||
import { ModalForm } from '@/components/Modal';
|
import { ModalForm } from '@/components/Modal';
|
||||||
import { useAuthSuspense } from '@/features/auth/backend/useAuth';
|
import { useAuthSuspense } from '@/features/auth/backend/useAuth';
|
||||||
import { CloneLibraryItemSchema, ICloneLibraryItemDTO } from '@/features/library/backend/api';
|
import { schemaCloneLibraryItem, ICloneLibraryItemDTO } from '@/features/library/backend/api';
|
||||||
import { useCloneItem } from '@/features/library/backend/useCloneItem';
|
import { useCloneItem } from '@/features/library/backend/useCloneItem';
|
||||||
import SelectAccessPolicy from '@/features/library/components/SelectAccessPolicy';
|
import SelectAccessPolicy from '@/features/library/components/SelectAccessPolicy';
|
||||||
import SelectLocationContext from '@/features/library/components/SelectLocationContext';
|
import SelectLocationContext from '@/features/library/components/SelectLocationContext';
|
||||||
|
@ -42,7 +42,7 @@ function DlgCloneLibraryItem() {
|
||||||
control,
|
control,
|
||||||
formState: { errors, isValid }
|
formState: { errors, isValid }
|
||||||
} = useForm<ICloneLibraryItemDTO>({
|
} = useForm<ICloneLibraryItemDTO>({
|
||||||
resolver: zodResolver(CloneLibraryItemSchema),
|
resolver: zodResolver(schemaCloneLibraryItem),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
id: base.id,
|
id: base.id,
|
||||||
item_type: base.item_type,
|
item_type: base.item_type,
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { Controller, useForm, useWatch } from 'react-hook-form';
|
||||||
|
|
||||||
import { Checkbox, TextArea, TextInput } from '@/components/Input';
|
import { Checkbox, TextArea, TextInput } from '@/components/Input';
|
||||||
import { ModalForm } from '@/components/Modal';
|
import { ModalForm } from '@/components/Modal';
|
||||||
import { IVersionCreateDTO, VersionCreateSchema } from '@/features/library/backend/api';
|
import { IVersionCreateDTO, schemaVersionCreate } from '@/features/library/backend/api';
|
||||||
import { useVersionCreate } from '@/features/library/backend/useVersionCreate';
|
import { useVersionCreate } from '@/features/library/backend/useVersionCreate';
|
||||||
import { IVersionInfo, LibraryItemID, VersionID } from '@/features/library/models/library';
|
import { IVersionInfo, LibraryItemID, VersionID } from '@/features/library/models/library';
|
||||||
import { nextVersion } from '@/features/library/models/libraryAPI';
|
import { nextVersion } from '@/features/library/models/libraryAPI';
|
||||||
|
@ -34,7 +34,7 @@ function DlgCreateVersion() {
|
||||||
const { versionCreate } = useVersionCreate();
|
const { versionCreate } = useVersionCreate();
|
||||||
|
|
||||||
const { register, handleSubmit, control } = useForm<IVersionCreateDTO>({
|
const { register, handleSubmit, control } = useForm<IVersionCreateDTO>({
|
||||||
resolver: zodResolver(VersionCreateSchema),
|
resolver: zodResolver(schemaVersionCreate),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
version: versions.length > 0 ? nextVersion(versions[0].version) : '1.0.0',
|
version: versions.length > 0 ? nextVersion(versions[0].version) : '1.0.0',
|
||||||
description: '',
|
description: '',
|
||||||
|
|
|
@ -37,7 +37,6 @@ function DlgDeleteCst() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalForm
|
<ModalForm
|
||||||
canSubmit
|
|
||||||
header='Удаление конституент'
|
header='Удаление конституент'
|
||||||
submitText={expandOut ? 'Удалить с зависимыми' : 'Удалить'}
|
submitText={expandOut ? 'Удалить с зависимыми' : 'Удалить'}
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
|
|
|
@ -39,7 +39,6 @@ function DlgEditEditors() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalForm
|
<ModalForm
|
||||||
canSubmit
|
|
||||||
header='Список редакторов'
|
header='Список редакторов'
|
||||||
submitText='Сохранить список'
|
submitText='Сохранить список'
|
||||||
className='flex flex-col w-[35rem] px-6 gap-3 pb-6'
|
className='flex flex-col w-[35rem] px-6 gap-3 pb-6'
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { MiniButton } from '@/components/Control';
|
||||||
import { IconReset, IconSave } from '@/components/Icons';
|
import { IconReset, IconSave } from '@/components/Icons';
|
||||||
import { TextArea, TextInput } from '@/components/Input';
|
import { TextArea, TextInput } from '@/components/Input';
|
||||||
import { ModalView } from '@/components/Modal';
|
import { ModalView } from '@/components/Modal';
|
||||||
import { IVersionUpdateDTO, VersionUpdateSchema } from '@/features/library/backend/api';
|
import { IVersionUpdateDTO, schemaVersionUpdate } from '@/features/library/backend/api';
|
||||||
import { useMutatingLibrary } from '@/features/library/backend/useMutatingLibrary';
|
import { useMutatingLibrary } from '@/features/library/backend/useMutatingLibrary';
|
||||||
import { useVersionDelete } from '@/features/library/backend/useVersionDelete';
|
import { useVersionDelete } from '@/features/library/backend/useVersionDelete';
|
||||||
import { useVersionUpdate } from '@/features/library/backend/useVersionUpdate';
|
import { useVersionUpdate } from '@/features/library/backend/useVersionUpdate';
|
||||||
|
@ -40,7 +40,7 @@ function DlgEditVersions() {
|
||||||
reset,
|
reset,
|
||||||
formState: { isDirty, errors: formErrors }
|
formState: { isDirty, errors: formErrors }
|
||||||
} = useForm<IVersionUpdateDTO>({
|
} = useForm<IVersionUpdateDTO>({
|
||||||
resolver: zodResolver(VersionUpdateSchema),
|
resolver: zodResolver(schemaVersionUpdate),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
id: schema.versions[0].id,
|
id: schema.versions[0].id,
|
||||||
version: schema.versions[0].version,
|
version: schema.versions[0].version,
|
||||||
|
|
|
@ -121,7 +121,6 @@ function DlgEditWordForms() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalForm
|
<ModalForm
|
||||||
canSubmit
|
|
||||||
header='Редактирование словоформ'
|
header='Редактирование словоформ'
|
||||||
submitText='Сохранить'
|
submitText='Сохранить'
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
|
|
|
@ -23,7 +23,6 @@ function DlgGraphParams() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalForm
|
<ModalForm
|
||||||
canSubmit
|
|
||||||
header='Настройки графа термов'
|
header='Настройки графа термов'
|
||||||
onSubmit={event => void handleSubmit(onSubmit)(event)}
|
onSubmit={event => void handleSubmit(onSubmit)(event)}
|
||||||
submitText='Применить'
|
submitText='Применить'
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { ModalForm } from '@/components/Modal';
|
||||||
import { HelpTopic } from '@/features/help/models/helpTopic';
|
import { HelpTopic } from '@/features/help/models/helpTopic';
|
||||||
import { useDialogsStore } from '@/stores/dialogs';
|
import { useDialogsStore } from '@/stores/dialogs';
|
||||||
|
|
||||||
import { CstRenameSchema, ICstRenameDTO } from '../backend/api';
|
import { ICstRenameDTO, schemaCstRename } from '../backend/api';
|
||||||
import { useCstRename } from '../backend/useCstRename';
|
import { useCstRename } from '../backend/useCstRename';
|
||||||
import { SelectCstType } from '../components/SelectCstType';
|
import { SelectCstType } from '../components/SelectCstType';
|
||||||
import { CstType, IConstituenta, IRSForm } from '../models/rsform';
|
import { CstType, IConstituenta, IRSForm } from '../models/rsform';
|
||||||
|
@ -25,7 +25,7 @@ function DlgRenameCst() {
|
||||||
const { cstRename } = useCstRename();
|
const { cstRename } = useCstRename();
|
||||||
|
|
||||||
const { register, setValue, handleSubmit, control } = useForm<ICstRenameDTO>({
|
const { register, setValue, handleSubmit, control } = useForm<ICstRenameDTO>({
|
||||||
resolver: zodResolver(CstRenameSchema),
|
resolver: zodResolver(schemaCstRename),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
target: target.id,
|
target: target.id,
|
||||||
alias: target.alias,
|
alias: target.alias,
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { useDialogsStore } from '@/stores/dialogs';
|
||||||
import { useModificationStore } from '@/stores/modification';
|
import { useModificationStore } from '@/stores/modification';
|
||||||
import { errors, labelCstTypification, labelTypification } from '@/utils/labels';
|
import { errors, labelCstTypification, labelTypification } from '@/utils/labels';
|
||||||
|
|
||||||
import { CstUpdateSchema, ICstUpdateDTO } from '../../../backend/api';
|
import { ICstUpdateDTO, schemaCstUpdate } from '../../../backend/api';
|
||||||
import { useCstUpdate } from '../../../backend/useCstUpdate';
|
import { useCstUpdate } from '../../../backend/useCstUpdate';
|
||||||
import { useMutatingRSForm } from '../../../backend/useMutatingRSForm';
|
import { useMutatingRSForm } from '../../../backend/useMutatingRSForm';
|
||||||
import RefsInput from '../../../components/RefsInput';
|
import RefsInput from '../../../components/RefsInput';
|
||||||
|
@ -47,7 +47,7 @@ function FormConstituenta({ disabled, id, toggleReset, schema, activeCst, onOpen
|
||||||
control,
|
control,
|
||||||
reset,
|
reset,
|
||||||
formState: { isDirty }
|
formState: { isDirty }
|
||||||
} = useForm<ICstUpdateDTO>({ resolver: zodResolver(CstUpdateSchema) });
|
} = useForm<ICstUpdateDTO>({ resolver: zodResolver(schemaCstUpdate) });
|
||||||
|
|
||||||
const [localParse, setLocalParse] = useState<IExpressionParse | undefined>(undefined);
|
const [localParse, setLocalParse] = useState<IExpressionParse | undefined>(undefined);
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { urls, useConceptNavigation } from '@/app';
|
||||||
import { SubmitButton } from '@/components/Control';
|
import { SubmitButton } from '@/components/Control';
|
||||||
import { IconSave } from '@/components/Icons';
|
import { IconSave } from '@/components/Icons';
|
||||||
import { Label, TextArea, TextInput } from '@/components/Input';
|
import { Label, TextArea, TextInput } from '@/components/Input';
|
||||||
import { IUpdateLibraryItemDTO, UpdateLibraryItemSchema } from '@/features/library/backend/api';
|
import { IUpdateLibraryItemDTO, schemaUpdateLibraryItem } from '@/features/library/backend/api';
|
||||||
import { useUpdateItem } from '@/features/library/backend/useUpdateItem';
|
import { useUpdateItem } from '@/features/library/backend/useUpdateItem';
|
||||||
import { LibraryItemType, VersionID } from '@/features/library/models/library';
|
import { LibraryItemType, VersionID } from '@/features/library/models/library';
|
||||||
import { useModificationStore } from '@/stores/modification';
|
import { useModificationStore } from '@/stores/modification';
|
||||||
|
@ -37,7 +37,7 @@ function FormRSForm() {
|
||||||
reset,
|
reset,
|
||||||
formState: { isDirty, errors }
|
formState: { isDirty, errors }
|
||||||
} = useForm<IUpdateLibraryItemDTO>({
|
} = useForm<IUpdateLibraryItemDTO>({
|
||||||
resolver: zodResolver(UpdateLibraryItemSchema),
|
resolver: zodResolver(schemaUpdateLibraryItem),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
id: controller.schema.id,
|
id: controller.schema.id,
|
||||||
item_type: LibraryItemType.RSFORM,
|
item_type: LibraryItemType.RSFORM,
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { IUserInfo, IUserProfile } from '../models/user';
|
||||||
/**
|
/**
|
||||||
* Represents signup data, used to create new users.
|
* Represents signup data, used to create new users.
|
||||||
*/
|
*/
|
||||||
export const UserSignupSchema = z
|
export const schemaUserSignup = z
|
||||||
.object({
|
.object({
|
||||||
username: z.string().nonempty(errors.requiredField).regex(RegExp(patterns.login), errors.loginFormat),
|
username: z.string().nonempty(errors.requiredField).regex(RegExp(patterns.login), errors.loginFormat),
|
||||||
email: z.string().email(errors.emailField),
|
email: z.string().email(errors.emailField),
|
||||||
|
@ -26,12 +26,12 @@ export const UserSignupSchema = z
|
||||||
/**
|
/**
|
||||||
* Represents signup data, used to create new users.
|
* Represents signup data, used to create new users.
|
||||||
*/
|
*/
|
||||||
export type IUserSignupDTO = z.infer<typeof UserSignupSchema>;
|
export type IUserSignupDTO = z.infer<typeof schemaUserSignup>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents user data, intended to update user profile in persistent storage.
|
* Represents user data, intended to update user profile in persistent storage.
|
||||||
*/
|
*/
|
||||||
export const UpdateProfileSchema = z.object({
|
export const schemaUpdateProfile = z.object({
|
||||||
email: z.string().email(errors.emailField),
|
email: z.string().email(errors.emailField),
|
||||||
first_name: z.string(),
|
first_name: z.string(),
|
||||||
last_name: z.string()
|
last_name: z.string()
|
||||||
|
@ -40,7 +40,7 @@ export const UpdateProfileSchema = z.object({
|
||||||
/**
|
/**
|
||||||
* Represents user data, intended to update user profile in persistent storage.
|
* Represents user data, intended to update user profile in persistent storage.
|
||||||
*/
|
*/
|
||||||
export type IUpdateProfileDTO = z.infer<typeof UpdateProfileSchema>;
|
export type IUpdateProfileDTO = z.infer<typeof schemaUpdateProfile>;
|
||||||
|
|
||||||
export const usersApi = {
|
export const usersApi = {
|
||||||
baseKey: 'users',
|
baseKey: 'users',
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { PrettyJson } from '@/components/View';
|
||||||
import { HelpTopic } from '@/features/help/models/helpTopic';
|
import { HelpTopic } from '@/features/help/models/helpTopic';
|
||||||
import { globals, patterns } from '@/utils/constants';
|
import { globals, patterns } from '@/utils/constants';
|
||||||
|
|
||||||
import { IUserSignupDTO, UserSignupSchema } from '../../backend/api';
|
import { IUserSignupDTO, schemaUserSignup } from '../../backend/api';
|
||||||
import { useSignup } from '../../backend/useSignup';
|
import { useSignup } from '../../backend/useSignup';
|
||||||
|
|
||||||
function FormSignup() {
|
function FormSignup() {
|
||||||
|
@ -31,7 +31,7 @@ function FormSignup() {
|
||||||
clearErrors,
|
clearErrors,
|
||||||
formState: { errors, isDirty }
|
formState: { errors, isDirty }
|
||||||
} = useForm<IUserSignupDTO>({
|
} = useForm<IUserSignupDTO>({
|
||||||
resolver: zodResolver(UserSignupSchema)
|
resolver: zodResolver(schemaUserSignup)
|
||||||
});
|
});
|
||||||
|
|
||||||
useBlockNavigation(isDirty);
|
useBlockNavigation(isDirty);
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { FlexColumn } from '@/components/Container';
|
||||||
import { SubmitButton } from '@/components/Control';
|
import { SubmitButton } from '@/components/Control';
|
||||||
import { ErrorData } from '@/components/InfoError';
|
import { ErrorData } from '@/components/InfoError';
|
||||||
import { TextInput } from '@/components/Input';
|
import { TextInput } from '@/components/Input';
|
||||||
import { ChangePasswordSchema, IChangePasswordDTO } from '@/features/auth/backend/api';
|
import { IChangePasswordDTO, schemaChangePassword } from '@/features/auth/backend/api';
|
||||||
import { useChangePassword } from '@/features/auth/backend/useChangePassword';
|
import { useChangePassword } from '@/features/auth/backend/useChangePassword';
|
||||||
|
|
||||||
function EditorPassword() {
|
function EditorPassword() {
|
||||||
|
@ -22,7 +22,7 @@ function EditorPassword() {
|
||||||
clearErrors,
|
clearErrors,
|
||||||
formState: { errors }
|
formState: { errors }
|
||||||
} = useForm<IChangePasswordDTO>({
|
} = useForm<IChangePasswordDTO>({
|
||||||
resolver: zodResolver(ChangePasswordSchema)
|
resolver: zodResolver(schemaChangePassword)
|
||||||
});
|
});
|
||||||
|
|
||||||
function resetErrors() {
|
function resetErrors() {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { SubmitButton } from '@/components/Control';
|
||||||
import { ErrorData } from '@/components/InfoError';
|
import { ErrorData } from '@/components/InfoError';
|
||||||
import { TextInput } from '@/components/Input';
|
import { TextInput } from '@/components/Input';
|
||||||
|
|
||||||
import { IUpdateProfileDTO, UpdateProfileSchema } from '../../backend/api';
|
import { IUpdateProfileDTO, schemaUpdateProfile } from '../../backend/api';
|
||||||
import { useProfileSuspense } from '../../backend/useProfile';
|
import { useProfileSuspense } from '../../backend/useProfile';
|
||||||
import { useUpdateProfile } from '../../backend/useUpdateProfile';
|
import { useUpdateProfile } from '../../backend/useUpdateProfile';
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ function EditorProfile() {
|
||||||
reset: resetForm,
|
reset: resetForm,
|
||||||
formState: { errors, isDirty }
|
formState: { errors, isDirty }
|
||||||
} = useForm<IUpdateProfileDTO>({
|
} = useForm<IUpdateProfileDTO>({
|
||||||
resolver: zodResolver(UpdateProfileSchema),
|
resolver: zodResolver(schemaUpdateProfile),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
first_name: profile.first_name,
|
first_name: profile.first_name,
|
||||||
last_name: profile.last_name,
|
last_name: profile.last_name,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user