Fix bug of cookies settings for inviter id (#18)
This commit is contained in:
1 parent
6a871cfdab
commit
b0faf7def1
5 files changed
+25
-21
No files matched your search
+1
-19
@@ -10,7 +10,6 @@ import { defineComponent } from 'vue';
|
||||
import { ElConfigProvider } from 'element-plus';
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs';
|
||||
import AuthPanel from './components/common/AuthPanel.vue';
|
||||
import { setCookie } from 'typescript-cookie';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@@ -19,25 +18,8 @@ export default defineComponent({
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
locale: zhCn,
|
||||
inviterId: this.$route.query.inviter_id?.toString()
|
||||
locale: zhCn
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.onSetCookie();
|
||||
},
|
||||
methods: {
|
||||
onSetCookie() {
|
||||
// set inviter to cookies to persist
|
||||
if (this.inviterId) {
|
||||
// current date + 7 days
|
||||
const expiration = new Date();
|
||||
expiration.setDate(expiration.getDate() + 7);
|
||||
setCookie('INVITER_ID', this.inviterId, {
|
||||
expires: expiration
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in new issue
Block a user