You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by E8y2FqZE May 31, 2024
I've made a "flash message" using the alert component that I want to show exactly once when someone successfully updates a resource. So for example if I set a cookie like this:
update users set
name = :name,
email = :email
where id = :id;
select 'cookie' as component,
'admin.alert.title' as name,
'User updated' as value;
select 'redirect' as component,
'user.sql?user=' || :id as link;
This cookie is correctly set.
And then in the page that it redirects to, I do this:
-- clear flash cookie
select 'cookie' as component, 'admin.alert.title' as name, true as remove;
--- display the value
select 'alert' as component,
sqlpage.cookie('admin.alert.title') as title,
'green' as color
where sqlpage.cookie('admin.alert.title') is not null;
The alert is correctly displayed, and I can see that the HTTP headers are trying to unset the cookie in the response (expiration date is in the past):
Frustratingly, Firefox and Chrome are both hanging on to the cookie and thus I'm continuing to see the alert. I don't think this is a technical problem with SQLPage because it looks like the correct HTTP header is being sent to remove the cookie, but I just can't wrap my mind around why this isn't working. In desperation I tried this, which does work.
select 'cookie' as component, 'admin.alert.title' as name, unixepoch() as expires, '' as value;
My computer clock is correct, so I am baffled at why true as remove doesn't work...
The text was updated successfully, but these errors were encountered:
Discussed in #361
Originally posted by E8y2FqZE May 31, 2024
I've made a "flash message" using the alert component that I want to show exactly once when someone successfully updates a resource. So for example if I set a cookie like this:
This cookie is correctly set.
And then in the page that it redirects to, I do this:
The alert is correctly displayed, and I can see that the HTTP headers are trying to unset the cookie in the response (expiration date is in the past):
Frustratingly, Firefox and Chrome are both hanging on to the cookie and thus I'm continuing to see the alert. I don't think this is a technical problem with SQLPage because it looks like the correct HTTP header is being sent to remove the cookie, but I just can't wrap my mind around why this isn't working. In desperation I tried this, which does work.
My computer clock is correct, so I am baffled at why
true as remove
doesn't work...The text was updated successfully, but these errors were encountered: