Skip to content

How to send payload with makeRequest method #361

Answered by jiripudil
emololftw asked this question in Support
Discussion options

You must be logged in to vote

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 in then(payload => payload.closeModal = true) is executed after the success listener, in which payload.closeModal is indeed undefined.

What you're seeing in the console is probably a consequence of how console.log is implemented in your browser. Quoting MDN:

Please be warned that if you log objects in the latest versions of Chrome and Firefox what you get logged on the console is a reference to the object, which is not necessarily the 'value' of the object at the moment in time you call console.log(), but it is the value …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@emololftw
Comment options

Answer selected by emololftw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
2 participants