@campxdev/shared 1.7.0 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/shared",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -19,6 +19,7 @@ interface FormProps extends Omit<RenderFormProps, 'control'> {
19
19
  postFunction: (body: any) => Promise<AxiosResponse>
20
20
  onPostSuccess: (response: any) => void
21
21
  onPostError: (error: any) => void
22
+ onFormError: (error: any) => void
22
23
  }
23
24
 
24
25
  export default function Form({
@@ -36,6 +37,7 @@ export default function Form({
36
37
  onPostSuccess,
37
38
  onPostError,
38
39
  gap,
40
+ onFormError,
39
41
  }: FormProps) {
40
42
  const queryClient = useQueryClient()
41
43
  const [error, setError] = useState<any>(null)
@@ -57,6 +59,7 @@ export default function Form({
57
59
  const onError = (error) => {
58
60
  const errorArray = Object.values(error)?.map((item: any) => item?.message)
59
61
  setError(errorArray)
62
+ onFormError && onFormError(error)
60
63
  }
61
64
 
62
65
  return (
@@ -67,6 +70,7 @@ export default function Form({
67
70
  >
68
71
  <RenderForm
69
72
  cols={cols}
73
+ gap={gap}
70
74
  fields={fields}
71
75
  control={control}
72
76
  dropdowns={dropdowns}
@@ -77,7 +81,7 @@ export default function Form({
77
81
  sx={{
78
82
  display: 'flex',
79
83
  gap: '20px',
80
- marginTop: gap,
84
+ marginTop: `20px`,
81
85
  justifyContent: 'center',
82
86
  }}
83
87
  >