I have global middleware that builds an object with user data (and other stuff later).
Here is an example: http://prntscr.com/fk710w
.......
Also I've tested this bug with random number: http://prntscr.com/fk71xi
In my master.njk view:
<pre>The num is: {{ randomNumber }}</pre>
Scenario:
Adonis: v3.0.10
NPM: 3.10.10
Node: v6.10.1
There is something messing up with an old request data?
How to get this thing working?
Thanks.
http://prntscr.com/fk8ojl -okay, now everything is fine. but it sucks a little bit.. :D
So maybe there is better solution to avoid this bug?
Hey @NViktors 馃憢
You must use response.viewInstance.global.
Example:
* handle (request, response, next) {
response.viewInstance.global('currentUrl', request.url())
response.viewInstance.global('currentOriginalUrl', request.originalUrl())
yield next
}
I suggest u to set globals on the view instance of response object
response.viewInstance.global()
Woow, thank you! now it works. :))
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
I suggest u to set globals on the view instance of response object