design-in-browser-bootstrap
design-in-browser-bootstrap copied to clipboard
Cookie warning atom
Cookie warning feature, requires js-cookie dependency
It might not be the best place to do this but it would be nice to have this code somewhere too:
if(document.location.pathname == '/'){
Cookies.remove('csrftoken');
}
People keep using csrf protection on the hompage of wagtail sites, and that completely disables frontend caching on the whole site, which can be a serious problem if there are a lot of visitors in a short period. This fixes that.
Also, I think adding this to DIBB (rather than to wagtail-kit) makes more sense because I guess this way we won't end up importing js-cookie twice.
@balazs-endresz the DIBB is used for both drupal and wagtail projects, would be cool to add some drupal/wagtail specific things in the future and somehow separate them (default drupal/wagtail form styling comes to mind), but not sure this is in scope at the moment.
Is js-cookie required by wagtail?
Sure, that makes sense. Also, what wagtail uses is independent from the site itself but we don't include js-cookie in wagtail-kit. I guess I'd just like to be able to use js-cookie in a way that we don't import it twice, and don't accidentally use another similar library in parallel to this. But you're right, this is a bit out of scope here.
I don't see the harm in including JS cookie stuff here - I'd rather it was merged in and left unused on a few projects than re-implementing it every time it's required. Will review this soon!