1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-14 14:21:23 +00:00

modify code repeat

This commit is contained in:
shanshuirenjia
2018-12-13 12:25:08 +08:00
parent c2da62e86b
commit 09534c08c7
2 changed files with 3 additions and 5 deletions

View File

@@ -44,7 +44,7 @@ class DirView extends React.Component {
} }
componentDidMount() { componentDidMount() {
//eg: http://127.0.0.1:8000/library/repo_id/repo_name/**/**/\ // eg: http://127.0.0.1:8000/library/repo_id/repo_name/**/**/\
let location = decodeURIComponent(window.location.href); let location = decodeURIComponent(window.location.href);
let repoID = this.props.repoID; let repoID = this.props.repoID;
seafileAPI.getRepoInfo(repoID).then(res => { seafileAPI.getRepoInfo(repoID).then(res => {
@@ -66,8 +66,7 @@ class DirView extends React.Component {
updateDirentList = (filePath) => { updateDirentList = (filePath) => {
let repoID = this.state.repoID; let repoID = this.state.repoID;
this.setState({isDirentListLoading: true}); this.setState({isDirentListLoading: true});
const path = Utils.encodePath(filePath); seafileAPI.listDir(repoID, filePath).then(res => {
seafileAPI.listDir(repoID, path).then(res => {
let direntList = res.data.map(item => { let direntList = res.data.map(item => {
return new Dirent(item); return new Dirent(item);
}); });

View File

@@ -247,8 +247,7 @@ class Wiki extends Component {
loadDirentList = (filePath) => { loadDirentList = (filePath) => {
this.setState({isDirentListLoading: true}); this.setState({isDirentListLoading: true});
const path = encodeURIComponent(filePath); seafileAPI.listDir(repoID, filePath).then(res => {
seafileAPI.listDir(repoID, path).then(res => {
let direntList = []; let direntList = [];
res.data.forEach(item => { res.data.forEach(item => {
let dirent = new Dirent(item); let dirent = new Dirent(item);