update logout logic

This commit is contained in:
AceDataCloud committed 2023-02-12 02:02:25 +08:00
1 parent f22d21bb53
commit 7e23b014b6
4 files changed
+19 -14

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
import { removeCookie } from 'typescript-cookie';
export const removeCookies = () => {
const host = window.location.host;
// process test env and prod env, for example:
// auth.zhishuyun.com -> .zhishuyun.com
// auth.test.zhishuyun.com -> .zhishuyun.com
const domain = host.replace(/^\S+?\.(test\.|local\.)?/, '.');
const path = '/';
// remove tokens from cookies
removeCookie('ACCESS_TOKEN', { domain, path });
removeCookie('REFRESH_TOKEN', { domain, path });
};