File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
- import { Button , Modal } from "antd"
1
+ import { Button , Modal , message } from "antd"
2
2
import { memo , useState } from "react"
3
3
import { useEditorStore } from "../../workflow-editor"
4
4
import { useTranslate } from "../../workflow-editor/react-locales"
@@ -20,19 +20,24 @@ const Tip = styled.div`
20
20
color: ${ props => props . theme . token ?. colorTextSecondary } ;
21
21
`
22
22
23
- export interface ErrorItem {
23
+ export interface IErrorItem {
24
24
category : string ,
25
25
message : string ,
26
26
}
27
27
28
28
export const PublishButton = memo ( ( ) => {
29
- const [ errors , setErrors ] = useState < ErrorItem [ ] > ( ) ;
29
+ const [ errors , setErrors ] = useState < IErrorItem [ ] > ( ) ;
30
30
31
31
const t = useTranslate ( )
32
32
const editorStore = useEditorStore ( )
33
33
34
34
const handleValidate = ( ) => {
35
- setErrors ( [ { category : "" , message : "" } ] ) ;
35
+ const result = editorStore ?. validate ( )
36
+ if ( result !== true ) {
37
+ setErrors ( [ { category : "" , message : "" } ] ) ;
38
+ } else {
39
+ message . info ( "验证成功" )
40
+ }
36
41
} ;
37
42
38
43
const handleOk = ( ) => {
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export class EditorStore {
20
20
}
21
21
22
22
validate = ( ) : IErrors | true => {
23
- throw new Error ( "Not implements" )
23
+ return true ;
24
24
}
25
25
26
26
dispatch = ( action : Action ) => {
You can’t perform that action at this time.
0 commit comments