Showing
2 changed files
with
31 additions
and
8 deletions
... | @@ -20,13 +20,21 @@ router.get('/show', function(req, res, next) { | ... | @@ -20,13 +20,21 @@ router.get('/show', function(req, res, next) { |
20 | folders = {} | 20 | folders = {} |
21 | let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; | 21 | let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; |
22 | connection.query(checkfolder, [curPath, user_id], function(err, rows, fields) { | 22 | connection.query(checkfolder, [curPath, user_id], function(err, rows, fields) { |
23 | - if (rows.length != 0) { | 23 | + if (err) { |
24 | - res.status(200).send({ | 24 | + console.log('select error'); |
25 | - folders: rows, | 25 | + res.status(404).send() |
26 | - cur: curPath | ||
27 | - }) | ||
28 | } else { | 26 | } else { |
29 | - res.send({ error: "Does not exist" }); | 27 | + if (rows.length != 0) { |
28 | + res.status(200).send({ | ||
29 | + folders: rows, | ||
30 | + cur: curPath | ||
31 | + }) | ||
32 | + } else { | ||
33 | + res.status(200).send({ | ||
34 | + folders: rows, | ||
35 | + cur: curPath | ||
36 | + }) | ||
37 | + } | ||
30 | } | 38 | } |
31 | }); | 39 | }); |
32 | }); | 40 | }); | ... | ... |
... | @@ -17,7 +17,7 @@ | ... | @@ -17,7 +17,7 @@ |
17 | <v-list-item | 17 | <v-list-item |
18 | v-for="item in this.$store.getters.folderL" | 18 | v-for="item in this.$store.getters.folderL" |
19 | :key="item.title" | 19 | :key="item.title" |
20 | - @click="$router.push({name: 'Folder'})" | 20 | + @click="moveF(item.folder_name)" |
21 | > | 21 | > |
22 | <v-list-item-avatar> | 22 | <v-list-item-avatar> |
23 | <v-icon>mdi-folder</v-icon> | 23 | <v-icon>mdi-folder</v-icon> |
... | @@ -139,7 +139,7 @@ import { folder, makeFolder } from '../api/index'; | ... | @@ -139,7 +139,7 @@ import { folder, makeFolder } from '../api/index'; |
139 | try { | 139 | try { |
140 | const curData = { | 140 | const curData = { |
141 | id : this.$store.state.id, | 141 | id : this.$store.state.id, |
142 | - cur: this.$store.state.cur | 142 | + cur: '/' |
143 | } | 143 | } |
144 | const response = await folder(curData); | 144 | const response = await folder(curData); |
145 | console.log(response); | 145 | console.log(response); |
... | @@ -172,6 +172,21 @@ import { folder, makeFolder } from '../api/index'; | ... | @@ -172,6 +172,21 @@ import { folder, makeFolder } from '../api/index'; |
172 | this.initFolderName(); | 172 | this.initFolderName(); |
173 | this.dialog = false; | 173 | this.dialog = false; |
174 | } | 174 | } |
175 | + }, | ||
176 | + async moveF(move_folder_name){ | ||
177 | + try { | ||
178 | + const curData = { | ||
179 | + id : this.$store.state.id, | ||
180 | + cur: this.$store.state.cur + move_folder_name + '/' | ||
181 | + } | ||
182 | + const response = await folder(curData); | ||
183 | + console.log(response); | ||
184 | + this.$store.commit('setFolder', response.data.folders); | ||
185 | + this.$store.commit('setCur', response.data.cur); | ||
186 | + } catch (error) { | ||
187 | + console.log("에러"); | ||
188 | + console.log(error.response.data); | ||
189 | + } | ||
175 | } | 190 | } |
176 | 191 | ||
177 | } | 192 | } | ... | ... |
-
Please register or login to post a comment