update remove cookie logic

This commit is contained in:
AceDataCloud committed 2023-01-25 16:55:00 +08:00
1 parent 8198ea4399
commit a3e1a93524
3 files changed
+11 -5

No files matched your search

+8 -2
View File
@@ -24,8 +24,14 @@ export default defineComponent({
if (this.accessToken && this.refreshToken) {
await this.$store.dispatch('setAccessToken', this.accessToken);
await this.$store.dispatch('setRefreshToken', this.refreshToken);
removeCookie('ACCESS_TOKEN');
removeCookie('REFRESH_TOKEN');
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\.)?/, '.');
const path = '/';
removeCookie('ACCESS_TOKEN', { domain, path });
removeCookie('REFRESH_TOKEN', { domain, path });
if (this.redirect) {
this.$router.push(this.redirect);
}