-
|
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
makeRequestdoesn'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 thesuccesslistener, in whichpayload.closeModalis indeedundefined.What you're seeing in the console is probably a consequence of how
console.logis implemented in your browser. Quoting MDN: