Hong

폴더이동

......@@ -20,13 +20,21 @@ router.get('/show', function(req, res, next) {
folders = {}
let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;';
connection.query(checkfolder, [curPath, user_id], function(err, rows, fields) {
if (rows.length != 0) {
res.status(200).send({
folders: rows,
cur: curPath
})
if (err) {
console.log('select error');
res.status(404).send()
} else {
res.send({ error: "Does not exist" });
if (rows.length != 0) {
res.status(200).send({
folders: rows,
cur: curPath
})
} else {
res.status(200).send({
folders: rows,
cur: curPath
})
}
}
});
});
......
......@@ -17,7 +17,7 @@
<v-list-item
v-for="item in this.$store.getters.folderL"
:key="item.title"
@click="$router.push({name: 'Folder'})"
@click="moveF(item.folder_name)"
>
<v-list-item-avatar>
<v-icon>mdi-folder</v-icon>
......@@ -139,7 +139,7 @@ import { folder, makeFolder } from '../api/index';
try {
const curData = {
id : this.$store.state.id,
cur: this.$store.state.cur
cur: '/'
}
const response = await folder(curData);
console.log(response);
......@@ -172,6 +172,21 @@ import { folder, makeFolder } from '../api/index';
this.initFolderName();
this.dialog = false;
}
},
async moveF(move_folder_name){
try {
const curData = {
id : this.$store.state.id,
cur: this.$store.state.cur + move_folder_name + '/'
}
const response = await folder(curData);
console.log(response);
this.$store.commit('setFolder', response.data.folders);
this.$store.commit('setCur', response.data.cur);
} catch (error) {
console.log("에러");
console.log(error.response.data);
}
}
}
......