Commit 100f3021 authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

onchangefile

parent d318b797
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
small-chips small-chips
dense dense
accept="image/*" accept="image/*"
@change="fileSelected"
/> />
</v-col> </v-col>
</v-row> </v-row>
...@@ -410,6 +411,7 @@ export default { ...@@ -410,6 +411,7 @@ export default {
middleware: ['web'], middleware: ['web'],
data: () => { data: () => {
return { return {
file: null,
dialog1: false, dialog1: false,
dialog2: false, dialog2: false,
title: '', title: '',
...@@ -417,7 +419,7 @@ export default { ...@@ -417,7 +419,7 @@ export default {
content: '', content: '',
user_id: '', user_id: '',
status: null, status: null,
images: null, images: [],
dialog: false, dialog: false,
dialogDelete: false, dialogDelete: false,
headers: [ headers: [
...@@ -603,7 +605,7 @@ export default { ...@@ -603,7 +605,7 @@ export default {
}, },
{ {
headers: { headers: {
'Content-Type': 'application/json; multipart/form-data; boundary=---------------------------974767299852498929531610575 ', 'Content-Type': 'application/json; multipart/form-data; boundary=---------------------------974767299852498929531610575 ',
Authorization: `Bearer ${this.$auth.$storage.getUniversal('token')}` Authorization: `Bearer ${this.$auth.$storage.getUniversal('token')}`
} }
} }
...@@ -716,6 +718,10 @@ export default { ...@@ -716,6 +718,10 @@ export default {
duration: 3000 duration: 3000
}) })
}) })
},
fileSelected (event) {
console.log(event)
console.log(this.images)
} }
} }
} }
......
export default function ({ $axios }, inject, redirect) { export default function ({ $axios }, inject, redirect) {
$axios.onError(error => { $axios.onError((error) => {
if(error.response.status === 500) { if (error.response.status === 500) {
redirect('/500') redirect('/500')
} }
}) })
$axios.onError(error => { $axios.onError((error) => {
const code = parseInt(error.response && error.response.status) const code = parseInt(error.response && error.response.status)
if (code === 400) { if (code === 400) {
redirect('/400') redirect('/400')
...@@ -22,4 +22,4 @@ export default function ({ $axios }, inject, redirect) { ...@@ -22,4 +22,4 @@ export default function ({ $axios }, inject, redirect) {
// Inject to context as $api // Inject to context as $api
inject('api', api) inject('api', api)
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment