add FhcAlert

This commit is contained in:
cgfhtw
2023-10-31 14:44:04 +01:00
parent aacba9f6ae
commit be7321723a
2 changed files with 9 additions and 5 deletions
+3
View File
@@ -20,6 +20,8 @@ import fhcapifactory from "./api/fhcapifactory.js";
import PvConfig from "../../../index.ci.php/public/js/components/primevue/config/config.esm.min.js";
import FhcAlert from "../plugin/FhcAlert.js";
Vue.$fhcapi = fhcapifactory;
const ciPath = FHC_JS_DATA_STORAGE_OBJECT.app_root.replace(/(https:|)(^|\/\/)(.*?\/)/g, '') + FHC_JS_DATA_STORAGE_OBJECT.ci_router;
@@ -39,5 +41,6 @@ const app = Vue.createApp();
app
.use(router)
.use(PvConfig)
.use(FhcAlert)
.mount('#main');
@@ -123,16 +123,17 @@ export default {
this.gebDatumIsValid = true;
// TODO(chris): phrase
this.addToast('Gespeichert', '', 'success');
this.$fhcAlert.alertSuccess('Gespeichert');
//this.addToast('Gespeichert', '', 'success');
this.original = {...this.data};
this.changed = {};
}
})
.catch(err => {
.catch(this.$fhcAlert.handleSystemError/*err => {
// TODO(chris): phrase
this.addToast('Error', err?.response?.data || err?.message, 'error');
})
}*/);
},
resetErrors() {
Array.from(this.$refs.form.getElementsByClassName('is-valid')).forEach(el => el.classList.remove('is-valid'));
@@ -156,14 +157,14 @@ export default {
feedback.classList.add('invalid-feedback');
feedback.innerHTML = msg;
input.after(feedback);
},
/*},
addToast(header, msg, severity) {
this.$refs.responseToast.add({
severity: severity,
summary: header,
detail: msg,
life: 3000
})
})*/
}
},
created() {