From 5f419c4041528ed9eff4549ed3511881e798ba36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Wed, 12 Oct 2022 13:31:21 +0200 Subject: [PATCH] fix no success msg --- src/JsCallback.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/JsCallback.php b/src/JsCallback.php index a6cfa30ede..ef559158d5 100644 --- a/src/JsCallback.php +++ b/src/JsCallback.php @@ -108,8 +108,14 @@ public function set($fx = null, $args = null) */ public function terminateAjax($ajaxec, $msg = null, bool $success = true): void { + $data = ['success' => $success]; + if (!$success) { + $data['message'] = $msg; + } + $data['atkjs'] = $ajaxec; + if ($this->canTerminate()) { - $this->getApp()->terminateJson(['success' => $success, ...($msg !== null ? ['message' => $msg] : []), 'atkjs' => $ajaxec]); + $this->getApp()->terminateJson($data); } }