leeseohyeon

Merge remote-tracking branch 'origin/file_front' into new_file

......@@ -35,6 +35,50 @@ function moveFolder(folderData) {
return axios.post('/api/folder/move', folderData);
}
function file(curData){
return axios.get('/api/file', {
params: {
id: curData.id,
cur: curData.cur
}
});
}
function uploadFile(fileData){
return axios.post('/api/file/upload', fileData);
}
function detailFile(fileData){
return axios.get(`/api/file/${fileData.name}`, {
params:{
id: fileData.id,
cur: fileData.cur
}
})
}
function deleteFile(fileData){
return axios.get('/api/file/delete', {
params:{
//현재 접속한 사람의 id와 삭제할 파일의 이름, 현재 폴더위치를 파라미터로 넘긴다.
id: fileData.id,
name: fileData.fileName,
cur: fileData.cur
}
});
}
function downloadFile(fileData){
return axios.get('api/file/download', {
params:{
//현재 접속한 사람의 id와 다운로드를 위해 선택한 파일의 이름을 파라미터로 넘긴다.
id: fileData.id,
name: fileData.fileName,
cur: fileData.cur
}
});
}
export { registerUser, loginUser, folder, makeFolder, deleteFolder, moveFolder };
export { registerUser, loginUser, folder, makeFolder, deleteFolder, moveFolder,
file, uploadFile, deleteFile, downloadFile };
......
......@@ -29,7 +29,7 @@
<v-list-item-title v-text="item.folder_name"></v-list-item-title>
</v-list-item-content>
<v-menu
v-model="showMenu"
......@@ -134,7 +134,9 @@
+{{ files.length - 2 }} File(s)
</span>
</template>
</v-file-input>
<v-btn color="blue" @click = "upload_file">upload</v-btn>
<v-btn
bottom
color="blue"
......@@ -177,7 +179,7 @@
</div>
</template>
<script>
import { folder, makeFolder, deleteFolder, moveFolder } from '../api/index';
import { folder, makeFolder, deleteFolder, moveFolder, file, uploadFile, deleteFile, downloadFile } from '../api/index';
import Axios from 'axios';
export default {
data() {
......@@ -203,12 +205,17 @@ import Axios from 'axios';
id : this.$store.state.id,
cur: '/'
}
console.log(curData);
const response = await folder(curData);
const {file_response} = await file(curData);
console.log(response.data);
console.log(file_response);
this.$store.commit('setFolder', response.data.folders);
this.$store.commit('setCur', response.data.cur);
this.$store.commit('setParent', response.data.parentPath);
this.folders = this.$store.getters.folderL;
this.$store.commit('setFile', file_response.data.files);
this.files = this.$store.getters.fileL;
} catch (error) {
console.log("에러");
console.log(error.response.data);
......@@ -316,6 +323,30 @@ import Axios from 'axios';
this.dialog2 = false;
}
},
async upload_file(){
try{
const fileData={
file: this.files,
user_id: this.$store.state.id,
cur: this.$store.state.cur
}
console.log(fileData)
const response = await uploadFile(fileData);
const filelist = await file(fileData.user_id);
console.log(response.message);
this.$store.commit('setFile', filelist.data.files);
this.files = this.$store.getters.fileL;
}catch(error){
const fileData={
file: this.files,
user_id: this.$store.state.id,
cur: this.$store.state.cur
}
console.log(fileData);
console.log("에러");
console.log(error.reponse.err);
}
},
show (folderN, e) {
e.preventDefault()
this.curfName = folderN;
......@@ -328,4 +359,4 @@ import Axios from 'axios';
}
}
}
</script>
\ No newline at end of file
</script>
......