Skip to content
Snippets Groups Projects
Commit c356734b authored by Haakon Gunleiksrud's avatar Haakon Gunleiksrud
Browse files

feat/add code smell

parent 1e7a044a
No related branches found
No related tags found
1 merge request!16feat/add preview of image in workout if image file
Pipeline #142566 passed
...@@ -41,14 +41,17 @@ async function retrieveWorkout(id) { ...@@ -41,14 +41,17 @@ async function retrieveWorkout(id) {
let pathArray = file.file.split("/"); let pathArray = file.file.split("/");
a.text = pathArray[pathArray.length - 1]; a.text = pathArray[pathArray.length - 1];
a.className = "me-2"; a.className = "me-2";
filesDiv.appendChild(a); let img
let isImage = ["jpg", "png", "gif", "jpeg", "JPG", "PNG", "GIF", "JPEG"].includes(a.text.split(".")[1]);
let isImage = ["jpg", "png", "gif", "jpeg"].includes(a.text.split(".")[1]);
if(isImage){ if(isImage){
let img = document.createElement("img"); img = document.createElement("img");
img.src = file.file; img.src = file.file;
img.width = "500"; img.width = "500";
}
filesDiv.appendChild(a);
if(isImage){
filesDiv.appendChild(img); filesDiv.appendChild(img);
} }
} }
......
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