mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
✨ 幻想真境剧诗适配-战绩页面 #113
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
/**
|
||||
* @file core/utils/getGameRecord.ts
|
||||
* @description 获取游戏数据的函数
|
||||
* @since Beta v0.3.8
|
||||
* @since Beta v0.4.10
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
import type { Response } from "@tauri-apps/api/http";
|
||||
|
||||
import TGApi from "../api/TGApi";
|
||||
import TGUtils from "../utils/TGUtils";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
|
||||
/**
|
||||
* @description 获取用户游戏数据
|
||||
* @since Beta v0.3.8
|
||||
* @since Beta v0.4.10
|
||||
* @description 这边的 ck 可以是 cookie_token 和 account_id
|
||||
* @description 也可以是 ltoken 和 ltuid
|
||||
* @param {Record<string, string>} cookie cookie
|
||||
@@ -26,12 +27,8 @@ export async function getGameRecord(
|
||||
const params = { role_id: user.gameUid, server: user.region };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
return await http
|
||||
.fetch<TGApp.Game.Record.Response | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
})
|
||||
.then((res) => {
|
||||
.fetch(url, { method: "GET", headers: header, query: params })
|
||||
.then((res: Response<TGApp.Game.Record.Response | TGApp.BBS.Response.Base>) => {
|
||||
if (res.data.retcode !== 0) {
|
||||
return <TGApp.BBS.Response.Base>res.data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user