Skip to content
Snippets Groups Projects
Commit a6e729de authored by johnshaughnessy's avatar johnshaughnessy
Browse files

Make sure to show error object if upload fails.

parent 0b4cb190
No related branches found
No related tags found
No related merge requests found
...@@ -42,12 +42,16 @@ export const addMedia = (src, resize = false) => { ...@@ -42,12 +42,16 @@ export const addMedia = (src, resize = false) => {
scene.appendChild(entity); scene.appendChild(entity);
if (typeof src === "object") { if (typeof src === "object") {
upload(src).then(response => { upload(src)
const src = response.raw; .then(response => {
const contentType = response.meta.expected_content_type; const src = response.raw;
const token = response.meta.access_token; const contentType = response.meta.expected_content_type;
entity.setAttribute("media-loader", { src, contentType, token }); const token = response.meta.access_token;
}); entity.setAttribute("media-loader", { src, contentType, token });
})
.catch(() => {
entity.setAttribute("media-loader", { src: "error" });
});
} }
return entity; return entity;
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment