Skip to content

Commit 6ff990b

Browse files
committed
backup
1 parent 1129663 commit 6ff990b

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/example/WorkflowEditor/PublishButton.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Button, Modal } from "antd"
1+
import { Button, Modal, message } from "antd"
22
import { memo, useState } from "react"
33
import { useEditorStore } from "../../workflow-editor"
44
import { useTranslate } from "../../workflow-editor/react-locales"
@@ -20,19 +20,24 @@ const Tip = styled.div`
2020
color: ${props => props.theme.token?.colorTextSecondary};
2121
`
2222

23-
export interface ErrorItem {
23+
export interface IErrorItem {
2424
category: string,
2525
message: string,
2626
}
2727

2828
export const PublishButton = memo(() => {
29-
const [errors, setErrors] = useState<ErrorItem[]>();
29+
const [errors, setErrors] = useState<IErrorItem[]>();
3030

3131
const t = useTranslate()
3232
const editorStore = useEditorStore()
3333

3434
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+
}
3641
};
3742

3843
const handleOk = () => {

src/workflow-editor/classes/EditorStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class EditorStore {
2020
}
2121

2222
validate = (): IErrors | true => {
23-
throw new Error("Not implements")
23+
return true;
2424
}
2525

2626
dispatch = (action: Action) => {

0 commit comments

Comments
 (0)