sap.ui.define([
"ea/zcertemp/controller/BaseController",
"sap/m/MessageToast",
"sap/m/MessageBox"
], function (BaseController, MessageBox, MessageToast) {
...
onCreate: function () {
const oModel = this.getView().getModel();
const oSmartForm = this.byId("smartForm");
if (oSmartForm.check().length > 0)
return;
oModel.submitChanges({
success: function (oData, oResp) {
const oError = oData.__batchResponses.find(
(element) => element.statusCode == undefined
);
if (oError) {
MessageToast.show(JSON.parse(oError.response.body)
.error.message.value);
return;
}
MessageToast.show("자격증 정보가 성공적으로 생성되었습니다.");
this.oDialog.close();
}.bind(this),
error: function (oError) {
var oMsg = JSON.parse(oError.responseText);
MessageBox.error(oMsg.error.message.value);
}
});
},