-
Hi guys, i have problem with sending payload throught confirm-modal.js
and naja.js
The topic is, send payload by clicking inside modal window. Payload message is But when i try to access closeModal directly: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, Naja's What you're seeing in the console is probably a consequence of how
In your case, you don't need to abuse naja.makeRequest('GET', e.relatedTarget.getAttribute('data-href'), null, {closeModal: true}); and then: naja.addEventListener('success', event => {
let modal = event.detail.options.closeModal;
// ...
} Hope this helps :) |
Beta Was this translation helpful? Give feedback.
Hi,
Naja's
makeRequest
doesn't resolve its promise until the request and response are fully processed – which includes dispatching lifecycle events. Therefore, the code inthen(payload => payload.closeModal = true)
is executed after thesuccess
listener, in whichpayload.closeModal
is indeedundefined
.What you're seeing in the console is probably a consequence of how
console.log
is implemented in your browser. Quoting MDN: