|
|
|
@ -23,15 +23,20 @@ export default {
|
|
|
|
const formData = new FormData();
|
|
|
|
const formData = new FormData();
|
|
|
|
formData.append('file', files[0], files[0].name);
|
|
|
|
formData.append('file', files[0], files[0].name);
|
|
|
|
|
|
|
|
|
|
|
|
fetch("/api/v1/items/", {method: 'POST', body: formData})
|
|
|
|
const user = JSON.parse(localStorage.getItem('user'));
|
|
|
|
|
|
|
|
const authHeader = user && user.access_token
|
|
|
|
|
|
|
|
? { Authorization: 'Bearer ' + user.access_token }
|
|
|
|
|
|
|
|
: {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fetch("/api/v1/items/", { method: 'POST', body: formData, headers: authHeader })
|
|
|
|
.then(res => res.json())
|
|
|
|
.then(res => res.json())
|
|
|
|
.then(data => this.response = data)
|
|
|
|
.then(data => this.response = data)
|
|
|
|
.catch((e) => console.log(e))
|
|
|
|
.catch((e) => console.log(e))
|
|
|
|
.then(()=>this.showModal=!this.showModal)
|
|
|
|
.then(() => this.showModal = !this.showModal)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
computed: {
|
|
|
|
result(){
|
|
|
|
result() {
|
|
|
|
if (this.response.status === "Success") {
|
|
|
|
if (this.response.status === "Success") {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
status: "Success!",
|
|
|
|
status: "Success!",
|
|
|
|
|