Commit 47539201 authored by Matija Obreza's avatar Matija Obreza

Merge branch...

Merge branch '661-user-doesn-t-have-possibility-to-logout-if-admin-delete-him-account' into 'master'

Resolve "User doesn`t have possibility to logout if admin delete him account;"

Closes #661

See merge request genesys-pgr/genesys-ui!660
parents ea1739a5 1ecfa528
......@@ -148,13 +148,17 @@ export function saveCookies(resp, expireOn: number, apiUrl: string) {
if (resp.refresh_token) {
cookies.set('refresh_token', resp.refresh_token, {domain, path: '/', expires: expDate });
} else {
document.cookie = 'refresh_token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
document.cookie = `refresh_token=; domain=${domain}; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
}
}
export function clearCookies() {
const domain = typeof document !== 'undefined' && document.location.origin.includes('.')
? `.${document.location.origin.split('.').filter((item, index, arr) => index > arr.length - 3).join('.')}`
: 'localhost';
log('Clearing cookies');
['authorities', 'access_token', 'refresh_token'].forEach((key) => document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`);
['authorities', 'access_token', 'refresh_token'].forEach((key) => document.cookie = `${key}=; domain=${domain}; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`);
}
export function isNumeric(value: any): boolean {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment