Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Move constant above main block

dominik-zeglen3cc7f84f3994
diff --git a/saleor/static/dashboard/js/components/image-gallery.js b/saleor/static/dashboard/js/components/image-gallery.js
index 0eeadb8dd2..7404789340 100644
--- a/saleor/static/dashboard/js/components/image-gallery.js
+++ b/saleor/static/dashboard/js/components/image-gallery.js
@@ -1,11 +1,15 @@
import Dropzone from 'dropzone';
import Sortable from 'sortablejs';
-const createLink = (link, index, replacement) => {
+function createLink (link, index, replacement) {
const outputLink = link.attr('data-href-template').split('/');
outputLink[outputLink.length + index] = replacement;
return outputLink.join('/')
-};
+}
+
+const productGallery = document.getElementById('product-gallery');
+
+// -----
$('#product-image-form').dropzone({
paramName: 'image_0',
@@ -34,7 +38,7 @@ $('#product-image-form').dropzone({
});
}
});
-const productGallery = document.getElementById('product-gallery');
+
if (productGallery) {
Sortable.create(productGallery, {
handle: '.sortable__drag-area',