Skip to content

Commit

Permalink
chore: modify pasteCookie way
Browse files Browse the repository at this point in the history
  • Loading branch information
FireBushtree committed Jan 18, 2023
1 parent 0cd5fd2 commit 4074f33
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/content-scripts/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ export const cache = {
},

pasteCookie (cookie: string) {
window.document.cookie = cookie
if (!cookie) {
return
}

cookie.split(';').forEach(item => {
const [key, value] = item.split('=')
console.log(key)
const date = new Date()
date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000))
const expires = '; expires=' + date.toUTCString()
document.cookie = key + '=' + (value || '') + expires + '; path=/'
})
},

clearCookie () {
Expand Down

0 comments on commit 4074f33

Please sign in to comment.