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:
@@ -52,6 +52,11 @@ export function showApiError(context, error, fallback = 'tr:error.network') {
|
||||
showError(context, fallback, fallback);
|
||||
}
|
||||
|
||||
export async function confirmAction(context, options = {}) {
|
||||
const refs = getRootRefs(context);
|
||||
return refs.chooseDialog?.open?.(options) ?? false;
|
||||
}
|
||||
|
||||
export default {
|
||||
install(app) {
|
||||
const getAppContext = () => app._instance?.proxy;
|
||||
@@ -61,7 +66,8 @@ export default {
|
||||
showSuccess: (...args) => showSuccess(getAppContext(), ...args),
|
||||
showInfo: (...args) => showInfo(getAppContext(), ...args),
|
||||
showError: (...args) => showError(getAppContext(), ...args),
|
||||
showApiError: (...args) => showApiError(getAppContext(), ...args)
|
||||
showApiError: (...args) => showApiError(getAppContext(), ...args),
|
||||
confirmAction: (...args) => confirmAction(getAppContext(), ...args)
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user