chore: 客戶端自動添加 token 和 device_id 到 Cookie 裡, 以便 HTTP 請求
This commit is contained in:
@@ -67,8 +67,11 @@ class Client {
|
|||||||
const re = await this.invoke("User.auth", {
|
const re = await this.invoke("User.auth", {
|
||||||
access_token: token
|
access_token: token
|
||||||
}, timeout)
|
}, timeout)
|
||||||
if (re.code == 200)
|
if (re.code == 200) {
|
||||||
await this.updateCachedProfile()
|
await this.updateCachedProfile()
|
||||||
|
document.cookie = 'token=' + token
|
||||||
|
document.cookie = 'device_id=' + data.device_id
|
||||||
|
}
|
||||||
return re
|
return re
|
||||||
}
|
}
|
||||||
static async updateCachedProfile() {
|
static async updateCachedProfile() {
|
||||||
|
|||||||
Reference in New Issue
Block a user