This commit is contained in:
Shubham Mehrotra 2020-06-26 14:52:52 +05:30
parent e806156dae
commit e3f80b886f
4 changed files with 58 additions and 28 deletions

View File

@ -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')}`
// );
}
},

View File

@ -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();
});
}
}

View File

@ -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') }}"
);
});
}
}

View File

@ -51,7 +51,7 @@
@endif
@if (! $results)
<h1 class="fw6 col-12">{{ __('shop::app.search.no-results') }}</h1>
<h1 class="fw6 col-12">{{ __('shop::app.search.no-results') }}</h1>
@else
@if ($results->isEmpty())
<h1 class="fw6 col-12">{{ __('shop::app.products.whoops') }}</h1>