mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-17 17:54:32 +08:00
修改退出进程逻辑
This commit is contained in:
@@ -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 }) => {
|
||||
|
||||
Reference in New Issue
Block a user