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

+2 -1
View File
@@ -1,4 +1,5 @@
export default {
paidSuccessfully: '支付成功',
createFailed: '创建失败'
createFailed: '创建失败',
wechatPayHelp: '请打开手机微信,扫一扫完成支付'
};
+1 -2
View File
@@ -1,5 +1,4 @@
export default {
info: '订单信息',
payWayWechat: '微信支付',
wechatPayHelp: '请打开手机微信,扫一扫完成支付'
payWayWechat: '微信支付'
};
+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);
}