fix: rename value to message in HandleUseFormCallback return type

BREAKING CHANGE: Migrate your onSubmit handlers to return a `message` instead of `value`
This commit is contained in:
Divlo
2023-04-02 22:08:32 +02:00
parent 69f12002c7
commit 5bb73df804
4 changed files with 9 additions and 9 deletions

View File

@ -38,13 +38,13 @@ export type HandleUseForm<K extends Schema> = (
export interface GlobalMessage {
type: 'error' | 'success'
value?: string
message?: string
properties?: undefined
}
export interface PropertiesMessage<K extends Schema> {
type: 'error'
value?: string
message?: string
properties: { [key in keyof Partial<K>]: string }
}
@ -129,8 +129,8 @@ export const useForm = <K extends Schema>(
formElement
)
if (message != null) {
const { value, type, properties } = message
setMessage(value)
const { message: messageValue, type, properties } = message
setMessage(messageValue)
setFetchState(type)
if (type === 'error') {
const propertiesErrors: ErrorsObject<typeof validationSchema> =