diff --git a/src/component/FileManager/Modals.js b/src/component/FileManager/Modals.js index 6cfadfb..c142450 100644 --- a/src/component/FileManager/Modals.js +++ b/src/component/FileManager/Modals.js @@ -10,7 +10,7 @@ import { } from "../../actions/index" import PathSelector from "./PathSelector" import axios from 'axios' - +import API from "../../middleware/Api" import { withStyles, Button, @@ -169,14 +169,12 @@ class ModalsCompoment extends Component { items.push(value.path === "/" ? value.path+value.name:value.path+"/"+value.name); } }); - axios.post('/File/Delete', { - action: 'delete', + API.delete('/object', { data: { items: items, dirs:dirs, - newPath:this.state.selectedPath === "//"?"/":this.state.selectedPath, - }) + }}) .then( (response)=> { - if(response.data.result.success){ + if(response.rawData.code == 0){ this.onClose(); this.props.refreshFileList(); }else{ @@ -290,17 +288,12 @@ class ModalsCompoment extends Component { this.props.toggleSnackbar("top","right","文件夹名称重复","warning"); this.props.setModalsLoading(false); }else{ - axios.post('/File/createFolder', { - action: '"createFolder"', - newPath: (this.props.path === "/"?"":this.props.path)+"/"+this.state.newFolderName, + API.put('/directory', { + path: (this.props.path === "/"?"":this.props.path)+"/"+this.state.newFolderName, }) .then( (response)=> { - if(response.data.result.success){ - this.onClose(); - this.props.refreshFileList(); - }else{ - this.props.toggleSnackbar("top","right",response.data.result.error,"warning"); - } + this.onClose(); + this.props.refreshFileList(); this.props.setModalsLoading(false); }) diff --git a/src/component/FileManager/Navigator.js b/src/component/FileManager/Navigator.js index 193b3dc..07374eb 100644 --- a/src/component/FileManager/Navigator.js +++ b/src/component/FileManager/Navigator.js @@ -184,11 +184,7 @@ class NavigatorCompoment extends Component { var newPath = path!==null?path:this.props.path; var apiURL = this.keywords===null?'/directory':'/File/SearchFile'; newPath = this.keywords===null?newPath:this.keywords; - API.get(apiURL, { - params: { - path: newPath, - } - }) + API.get(apiURL+newPath,) .then( (response)=> { this.props.updateFileList(response.data); this.props.setNavigatorLoadingStatus(false); diff --git a/src/middleware/Api.js b/src/middleware/Api.js index baa4038..77aaa32 100644 --- a/src/middleware/Api.js +++ b/src/middleware/Api.js @@ -13,7 +13,7 @@ instance.interceptors.response.use( function(response) { response.rawData = response.data; response.data = response.data.data; - if (response.rawData.code != 0){ + if (response.rawData.code != 0 && response.rawData.code != 203 ){ // 登录过期 if (response.rawData.code == 401){ Auth.signout();