mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2025-03-01 13:39:12 +08:00
20 lines
499 B
TypeScript
20 lines
499 B
TypeScript
![]() |
import Cookies from 'js-cookie'
|
||
|
|
||
|
export function setCookies(string: string) {
|
||
|
const cookies = string.replace('HTTPOnly', '').split(';;')
|
||
|
cookies.map(cookie => {
|
||
|
const cookieKeyValue = cookie.split(';')[0].split('=')
|
||
|
const [key, value] = cookieKeyValue
|
||
|
// store.account.cookies[key] = value
|
||
|
Cookies.set(key, value, { expires: 3650 })
|
||
|
})
|
||
|
}
|
||
|
|
||
|
export function getCookie(key: string) {
|
||
|
return Cookies.get(key)
|
||
|
}
|
||
|
|
||
|
export function removeCookie(key: string) {
|
||
|
Cookies.remove(key)
|
||
|
}
|