Showing
2 changed files
with
12 additions
and
5 deletions
... | @@ -33,7 +33,7 @@ router.get('/show', function(req, res, next) { | ... | @@ -33,7 +33,7 @@ router.get('/show', function(req, res, next) { |
33 | connection.query(checkfolder, [curPath, user_id], function(err, rows, fields) { | 33 | connection.query(checkfolder, [curPath, user_id], function(err, rows, fields) { |
34 | if (err) { | 34 | if (err) { |
35 | console.log('select error'); | 35 | console.log('select error'); |
36 | - res.status(404).send() | 36 | + res.status(400).send({ err: err }); |
37 | } else { | 37 | } else { |
38 | res.status(200).send({ | 38 | res.status(200).send({ |
39 | folders: rows, | 39 | folders: rows, |
... | @@ -62,12 +62,13 @@ router.post('/makefolder', function(req, res, next) { | ... | @@ -62,12 +62,13 @@ router.post('/makefolder', function(req, res, next) { |
62 | console.log(req.body) | 62 | console.log(req.body) |
63 | connection.query(checksql, [cur, folder_name], function(err, rows, fields) { | 63 | connection.query(checksql, [cur, folder_name], function(err, rows, fields) { |
64 | if (err) { | 64 | if (err) { |
65 | - | 65 | + res.status(400).send({ err: err }); |
66 | } else { | 66 | } else { |
67 | if (rows.length == 0) { | 67 | if (rows.length == 0) { |
68 | s3.putObject(params, function(err, data) { | 68 | s3.putObject(params, function(err, data) { |
69 | if (err) { | 69 | if (err) { |
70 | console.log('s3 error'); | 70 | console.log('s3 error'); |
71 | + res.status(400).send({ err: err }); | ||
71 | } else { | 72 | } else { |
72 | console.log(data); | 73 | console.log(data); |
73 | let sql = 'INSERT INTO folders (folder_name,location,user_id,created) values (?,?,?,?);'; | 74 | let sql = 'INSERT INTO folders (folder_name,location,user_id,created) values (?,?,?,?);'; |
... | @@ -75,7 +76,7 @@ router.post('/makefolder', function(req, res, next) { | ... | @@ -75,7 +76,7 @@ router.post('/makefolder', function(req, res, next) { |
75 | connection.query(sql, values, function(err, result, field) { | 76 | connection.query(sql, values, function(err, result, field) { |
76 | if (err) { | 77 | if (err) { |
77 | console.log('insert error'); | 78 | console.log('insert error'); |
78 | - throw err; | 79 | + res.status(400).send({ err: err }); |
79 | } else { | 80 | } else { |
80 | let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; | 81 | let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; |
81 | connection.query(checkfolder, [cur, user_id], function(err, rows, fields) { | 82 | connection.query(checkfolder, [cur, user_id], function(err, rows, fields) { |
... | @@ -116,13 +117,13 @@ router.post('/delfolder', function(req, res, next) { | ... | @@ -116,13 +117,13 @@ router.post('/delfolder', function(req, res, next) { |
116 | s3.deleteObject(params, function(err, data) { | 117 | s3.deleteObject(params, function(err, data) { |
117 | if (err) { | 118 | if (err) { |
118 | console.log('s3 error'); | 119 | console.log('s3 error'); |
119 | - //throw err; | 120 | + res.status(400).send({ err: err }); |
120 | } else { | 121 | } else { |
121 | console.log(data); | 122 | console.log(data); |
122 | let sql = 'DELETE FROM folders WHERE location = ? AND folder_name = ? AND user_id = ?;'; | 123 | let sql = 'DELETE FROM folders WHERE location = ? AND folder_name = ? AND user_id = ?;'; |
123 | connection.query(sql, values, function(err, result, field) { | 124 | connection.query(sql, values, function(err, result, field) { |
124 | if (err) { | 125 | if (err) { |
125 | - //throw err; | 126 | + res.status(400).send({ err: err }); |
126 | } else { | 127 | } else { |
127 | console.log(cur); | 128 | console.log(cur); |
128 | console.log(user_id); | 129 | console.log(user_id); | ... | ... |
... | @@ -248,11 +248,14 @@ export default { | ... | @@ -248,11 +248,14 @@ export default { |
248 | cur: this.$store.state.cur + move_folder_name + '/', | 248 | cur: this.$store.state.cur + move_folder_name + '/', |
249 | }; | 249 | }; |
250 | const response = await folder(curData); | 250 | const response = await folder(curData); |
251 | + const file_response = await file(curData); | ||
251 | console.log(response.data); | 252 | console.log(response.data); |
252 | this.$store.commit('setFolder', response.data.folders); | 253 | this.$store.commit('setFolder', response.data.folders); |
254 | + this.$store.commit('setFile', file_response.data.files); | ||
253 | this.$store.commit('setCur', response.data.cur); | 255 | this.$store.commit('setCur', response.data.cur); |
254 | this.$store.commit('setParent', response.data.parentPath); | 256 | this.$store.commit('setParent', response.data.parentPath); |
255 | this.folders = this.$store.getters.folderL; | 257 | this.folders = this.$store.getters.folderL; |
258 | + this.files = this.$store.getters.fileL; | ||
256 | } catch (error) { | 259 | } catch (error) { |
257 | console.log('에러'); | 260 | console.log('에러'); |
258 | console.log(error.response.data); | 261 | console.log(error.response.data); |
... | @@ -265,11 +268,14 @@ export default { | ... | @@ -265,11 +268,14 @@ export default { |
265 | cur: this.$store.state.parent, | 268 | cur: this.$store.state.parent, |
266 | }; | 269 | }; |
267 | const response = await folder(cData); | 270 | const response = await folder(cData); |
271 | + const file_response = await file(cData); | ||
268 | console.log(response.data); | 272 | console.log(response.data); |
269 | this.$store.commit('setFolder', response.data.folders); | 273 | this.$store.commit('setFolder', response.data.folders); |
274 | + this.$store.commit('setFile', file_response.data.files); | ||
270 | this.$store.commit('setCur', response.data.cur); | 275 | this.$store.commit('setCur', response.data.cur); |
271 | this.$store.commit('setParent', response.data.parentPath); | 276 | this.$store.commit('setParent', response.data.parentPath); |
272 | this.folders = this.$store.getters.folderL; | 277 | this.folders = this.$store.getters.folderL; |
278 | + this.files = this.$store.getters.fileL; | ||
273 | } catch (error) { | 279 | } catch (error) { |
274 | console.log('에러'); | 280 | console.log('에러'); |
275 | console.log(error.response.data); | 281 | console.log(error.response.data); | ... | ... |
-
Please register or login to post a comment