|
|
|
@ -23,7 +23,12 @@ 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))
|
|
|
|
|