Conversation
|
Thanks for the PR! as we plan to provide this as a hosted version for people to test on https://website.regtest.getalby.com/ I somehow think the persistence is a bit confusing. |
|
hej, wanted to follow up on this. let me know if I can be of any help. |
| amount: req.body.amount, | ||
| data: invoice.data | ||
| } | ||
| newInvoice = newInvoiceObj; |
There was a problem hiding this comment.
You should not use global variables.
If I understand your code correct, then here a global variable is defined with an invoice object. Then the user is redirected to / on / a template is rendered that uses that global variable and then that global variable is set to null again.
But think about what happens if two or more users use the app at the same time. Then that one global variable is shared among all users and they overwrite each other.
I think generally no global variables should be used. HTTP is stateless and when build web apps we need to respect that.
| } | ||
|
|
||
| let newInvoice = '<%- JSON.stringify(newInvoice) %>'; | ||
| newInvoice = JSON.parse(newInvoice); |
There was a problem hiding this comment.
I think something like this should be good enough:
let newInvoice = <%- JSON.stringify(newInvoice) %>;
Some new features for the playground: