Last active
December 4, 2020 10:29
-
-
Save bvandenbon/91d3e6d11363c08154b93f95eb4e9a0f to your computer and use it in GitHub Desktop.
CookieService
did you define delete method? or something similar to deleteAll ? looks good
I think you would just need to add the following 2 methods. (not tested).
a delete should be as follows:
delete(key: string): void {
document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:00 GMT`;
}
to delete all cookies, maybe something like this:
deleteAll(): void {
const cookies = document.cookie.split(";");
for (let i = 0; i < cookies.length; i++) {
const key = (cookies[i].split("=")[0]);
this.delete(key);
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice one thx