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) => {
scene.appendChild(entity);
if (typeof src === "object") {
upload(src).then(response => {
const src = response.raw;
const contentType = response.meta.expected_content_type;
const token = response.meta.access_token;
entity.setAttribute("media-loader", { src, contentType, token });
});
upload(src)
.then(response => {
const src = response.raw;
const contentType = response.meta.expected_content_type;
const token = response.meta.access_token;
entity.setAttribute("media-loader", { src, contentType, token });
})
.catch(() => {
entity.setAttribute("media-loader", { src: "error" });
});
}
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