Feat: 对接删除/创建目录对象

This commit is contained in:
HFO4 2019-11-30 15:47:26 +08:00
parent 3933ed44c6
commit 8f73231e26
3 changed files with 10 additions and 21 deletions

View File

@ -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);
})

View File

@ -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);

View File

@ -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();