|
@@ -13,7 +13,11 @@ const findObjectIndexById = (objs, goodId) => {
|
|
function saveImage(image) {
|
|
function saveImage(image) {
|
|
let formData = new FormData();
|
|
let formData = new FormData();
|
|
formData.append('photo', image.data);
|
|
formData.append('photo', image.data);
|
|
- let token = JSON.parse(JSON.parse(localStorage["persist:auth"]).token);
|
|
|
|
|
|
+ let token = "";
|
|
|
|
+ if (localStorage["persist:auth"])
|
|
|
|
+ token = JSON.parse(JSON.parse(localStorage["persist:auth"]).token);
|
|
|
|
+ else
|
|
|
|
+ token = JSON.parse(JSON.parse(localStorage["persist:root"]).auth).token;
|
|
let res = fetch(getFullBackendUrl('/upload'), {
|
|
let res = fetch(getFullBackendUrl('/upload'), {
|
|
method: "POST",
|
|
method: "POST",
|
|
headers: token ? { Authorization: 'Bearer ' + token } : {},
|
|
headers: token ? { Authorization: 'Bearer ' + token } : {},
|