Refactor feedback handling across components: Replace alert and confirm calls with centralized feedback functions for improved user experience. Update various components to utilize showError, showSuccess, and confirmAction for consistent messaging and confirmation dialogs. Enhance UI responsiveness and maintainability by streamlining feedback logic.
This commit is contained in:
@@ -173,6 +173,7 @@
|
||||
|
||||
<script>
|
||||
import apiClient from '@/utils/axios.js';
|
||||
import { showError, showSuccess } from '@/utils/feedback.js';
|
||||
export default {
|
||||
name: "SaleSection",
|
||||
props: {
|
||||
@@ -334,13 +335,13 @@
|
||||
quantity: quantityToSell,
|
||||
quality: item.quality,
|
||||
}).catch(() => {
|
||||
alert(this.$t('falukant.branch.sale.sellError'));
|
||||
showError(this, this.$t('falukant.branch.sale.sellError'));
|
||||
});
|
||||
},
|
||||
sellAll() {
|
||||
apiClient.post(`/api/falukant/sell/all`, { branchId: this.branchId })
|
||||
.catch(() => {
|
||||
alert(this.$t('falukant.branch.sale.sellAllError'));
|
||||
showError(this, this.$t('falukant.branch.sale.sellAllError'));
|
||||
});
|
||||
},
|
||||
inventoryOptions() {
|
||||
@@ -502,11 +503,11 @@
|
||||
});
|
||||
await this.loadInventory();
|
||||
await this.loadTransports();
|
||||
alert(this.$t('falukant.branch.sale.transportStarted'));
|
||||
showSuccess(this, this.$t('falukant.branch.sale.transportStarted'));
|
||||
this.$emit('transportCreated');
|
||||
} catch (error) {
|
||||
console.error('Error creating transport:', error);
|
||||
alert(this.$t('falukant.branch.sale.transportError'));
|
||||
showError(this, this.$t('falukant.branch.sale.transportError'));
|
||||
}
|
||||
},
|
||||
async loadTransports() {
|
||||
@@ -596,4 +597,4 @@
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user