diff --git a/packages/Webkul/Shop/src/Resources/views/guest/compare/compare-products.blade.php b/packages/Webkul/Shop/src/Resources/views/guest/compare/compare-products.blade.php index 2364067f6..79b138c7c 100644 --- a/packages/Webkul/Shop/src/Resources/views/guest/compare/compare-products.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/guest/compare/compare-products.blade.php @@ -218,8 +218,6 @@ } else { this.$set(this, 'products', this.products.filter(product => product.id != productId)); } - - // window.showAlert(`alert-${response.data.status}`, response.data.label, response.data.message); }) .catch(error => { console.log("{{ __('velocity::app.error.something_went_wrong') }}"); @@ -236,12 +234,6 @@ } this.setStorageValue('compared_product', updatedItems); - - // window.showAlert( - // `alert-success`, - // "{{ __('velocity::app.shop.general.alert.success') }}", - // `${this.__('customer.compare.removed')}` - // ); } }, diff --git a/packages/Webkul/Shop/src/Resources/views/layouts/header/index.blade.php b/packages/Webkul/Shop/src/Resources/views/layouts/header/index.blade.php index d5123c647..9b4bfe04d 100755 --- a/packages/Webkul/Shop/src/Resources/views/layouts/header/index.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/layouts/header/index.blade.php @@ -258,17 +258,30 @@ const imgElement = document.getElementById('uploaded-image-url'); - const result = await net.classify(imgElement); + try { + const result = await net.classify(imgElement); - result.forEach(function(value) { - queryString = value.className.split(','); + result.forEach(function(value) { + queryString = value.className.split(','); - if (queryString.length > 1) { - analysedResult = analysedResult.concat(queryString) - } else { - analysedResult.push(queryString[0]) - } - }) + if (queryString.length > 1) { + analysedResult = analysedResult.concat(queryString) + } else { + analysedResult.push(queryString[0]) + } + }); + } catch (error) { + self.$root.hideLoader(); + + window.flashMessages = [ + { + 'type': 'alert-error', + 'message': "{{ __('shop::app.common.error') }}" + } + ]; + + self.$root.addFlashMessages(); + }; localStorage.searched_image_url = self.uploaded_image_url; @@ -281,8 +294,17 @@ app(); }) - .catch(function() { + .catch(function(error) { self.$root.hideLoader(); + + window.flashMessages = [ + { + 'type': 'alert-error', + 'message': "{{ __('shop::app.common.error') }}" + } + ]; + + self.$root.addFlashMessages(); }); } } diff --git a/packages/Webkul/Velocity/src/Resources/views/shop/UI/particals.blade.php b/packages/Webkul/Velocity/src/Resources/views/shop/UI/particals.blade.php index cca7aa002..f8e343d74 100644 --- a/packages/Webkul/Velocity/src/Resources/views/shop/UI/particals.blade.php +++ b/packages/Webkul/Velocity/src/Resources/views/shop/UI/particals.blade.php @@ -389,17 +389,27 @@ const imgElement = document.getElementById('uploaded-image-url'); - const result = await net.classify(imgElement); + try { + const result = await net.classify(imgElement); - result.forEach(function(value) { - queryString = value.className.split(','); + result.forEach(function(value) { + queryString = value.className.split(','); - if (queryString.length > 1) { - analysedResult = analysedResult.concat(queryString) - } else { - analysedResult.push(queryString[0]) - } - }) + if (queryString.length > 1) { + analysedResult = analysedResult.concat(queryString) + } else { + analysedResult.push(queryString[0]) + } + }); + } catch (error) { + self.$root.hideLoader(); + + window.showAlert( + `alert-danger`, + this.__('shop.general.alert.error'), + "{{ __('shop::app.common.error') }}" + ); + } localStorage.searchedImageUrl = self.uploadedImageUrl; @@ -413,6 +423,12 @@ app(); }).catch(() => { this.$root.hideLoader(); + + window.showAlert( + `alert-danger`, + this.__('shop.general.alert.error'), + "{{ __('shop::app.common.error') }}" + ); }); } } diff --git a/packages/Webkul/Velocity/src/Resources/views/shop/search/search.blade.php b/packages/Webkul/Velocity/src/Resources/views/shop/search/search.blade.php index 30e8e0886..e0d2866b9 100644 --- a/packages/Webkul/Velocity/src/Resources/views/shop/search/search.blade.php +++ b/packages/Webkul/Velocity/src/Resources/views/shop/search/search.blade.php @@ -51,7 +51,7 @@ @endif @if (! $results) -