Iâll try that in the morning. But it doesnât give me much confidence in node if I have to rely on users to have caching turned off.
Iâm actually trying to follow your node videos and having problems just with the log out.
Update: disabling the cache got rid of the 304 status but still didnât log out properly. Have to keep spamming the logout button and eventually it works. Iâll investigate further in the morning.
Thatâs a very interesting thing, does this happens on localhost or just on the remote server?
If it happens on localhost the Wappler team might have to step in. And definitely, you should not tick the browserâs âDisable cacheâ, as that only solves the problem for you
If it happens just on the remote server, your web server might be overriding some HTTP cache parameter (initially set by NodeJS), causing those pages to be cached even when you donât want. In that case, can you tell us more about your setup?
I only have the localhost Wappler server, I don't have remote Node hosting to be able to test it there. When I click on the logout button it does give a 200 status (with caching turned off) for the logout server connect but nothing happens. Have to repeatedly click on the log out button and eventually it works. I am going to redo the log out process today. But I see no reason why it shouldn't work.
Try a new site with the Git repository. From there, you can figure out what has gone wrong.
A 304 status is not an error, it is a warning that the files have been loaded from the browserâs cache because there was no change in the files. That is why I suggested to disable the cache. It is a good habit to disable the cache while developing a site, just in case.
Solved! Thanks @ben! Comparing what you did to what I did I found one simple little mistake. On button click I had the user_logged_in server connect to âloadâ. Changing it to âresetâ solved everything. This must be a difference between php and node.js?
You have 3 dynamic events - what are they doing?
First of all - why call logout and redirect to / both on click? Whatâs the purpose of loading this scUserLoggedIn.load() on the same click event - what does it do?
On logout all you need to do is to load the logout server action ⌠all other events should be controlled by the logout action, not loaded next to it on the click event. That is wrong.
Maybe explain what each of these do and what exactly are you trying to achieve.
On Button click redirects to homepage when logged out in case user logs out in an admin page. Note: I haven't secured the pages yet. Still need to figure that part out. This action may not be needed after pages secured.
Reloads the user details query to hide menu and show login button.
Brad, on click you only should run the LOGOUT server action and nothing else.
On logout server action SUCCESS event you run everything else that needs to happen AFTER logout is done. You canât run 3 dynamic events on single click as you donât know when one has finished and start another. The whole concept here is wrong.
Well, I thought of the SUCCESS event but since there is no form there is no on Success? I am very curious as to what the proper procedure is. I need the recordset to reload after log out to hide the menu.
What do you mean there is no success event available?
You select the logout server action and select dynamic events > success ⌠you can add actions there.
And you should only run the logout server action on logout button click, nothing else. This has been like that since ages.
A logged-in-person will change the login button to a logout button and also make personal details available.
When a user logs out, the the logged-in-person status must change to reflect that. This is done by resetting the UserLoggedIn dataset.
The following is the code for the logout button:
<button id="btnLogout" class="btn" dmx-show="scUserLoggedin.data.identity" dmx-on:click="scLogout.load();scUserLoggedin.reset();notifies1.success('You are now logged out.')">Logout</button>
Normally, a load instruction would be sufficient. But in this case a reset is required:
This is where the problem was. @brad used load. He has now changed that to reset and all is well.