修改退出进程逻辑

This commit is contained in:
whyour
2022-12-05 15:26:22 +08:00
parent 23fd595582
commit b95fb9cda4
10 changed files with 76 additions and 125 deletions
+3 -2
View File
@@ -49,6 +49,7 @@ const EditModal = ({
const { theme } = useTheme();
const editorRef = useRef<any>(null);
const [isRunning, setIsRunning] = useState(false);
const [currentPid, setCurrentPid] = useState(null);
const cancel = () => {
handleCancel();
@@ -94,6 +95,7 @@ const EditModal = ({
.then(({ code, data }) => {
if (code === 200) {
setIsRunning(true);
setCurrentPid(data);
}
});
};
@@ -102,13 +104,12 @@ const EditModal = ({
if (!cNode || !cNode.title) {
return;
}
const content = editorRef.current.getValue().replace(/\r\n/g, '\n');
request
.put(`${config.apiPrefix}scripts/stop`, {
data: {
filename: cNode.title,
path: cNode.parent || '',
content,
pid: currentPid,
},
})
.then(({ code, data }) => {