mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 05:38:04 +00:00
19 lines
499 B
TypeScript
19 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)
|
|
}
|