添加全局loading

This commit is contained in:
hanhh
2021-09-18 15:08:45 +08:00
parent 6c87634bb3
commit 698c463c3a
4 changed files with 35 additions and 21 deletions
+19 -16
View File
@@ -141,22 +141,25 @@ const Script = ({ headerStyle, isPhone, theme }: any) => {
const content = editorRef.current
? editorRef.current.getValue().replace(/\r\n/g, '\n')
: value;
request
.put(`${config.apiPrefix}scripts`, {
data: {
filename: select,
content,
},
})
.then((_data: any) => {
if (_data.code === 200) {
message.success(`保存成功`);
setValue(content);
setIsEditing(false);
} else {
message.error(_data);
}
});
return new Promise((resolve) => {
request
.put(`${config.apiPrefix}scripts`, {
data: {
filename: select,
content,
},
})
.then((_data: any) => {
if (_data.code === 200) {
message.success(`保存成功`);
setValue(content);
setIsEditing(false);
} else {
message.error(_data);
}
resolve(null);
});
});
},
onCancel() {
console.log('Cancel');