♻️ 减少耦合

This commit is contained in:
BTMuli
2023-05-20 12:53:44 +08:00
parent 51b8d0277a
commit 4899879b02
9 changed files with 40 additions and 69 deletions

View File

@@ -7,13 +7,10 @@
// tauri
import { http } from "@tauri-apps/api";
// Node
import qs from "qs";
// api
import TGApi from "../api/TGApi";
// utils
import TGUtils from "../utils/TGUtils";
import { transCookie } from "../utils/tools";
/**
* @description 根据 login_ticket 获取游戏 Token包括 stoken 和 ltoken
@@ -30,7 +27,7 @@ export async function getTokensByLoginTicket (ticket: string, uid: string): Prom
const url = TGApi.GameTokens.getTokens;
// eslint-disable-next-line camelcase
const params = { login_ticket: ticket, token_types: 3, uid };
const header = TGUtils.User.getHeader(transCookie(cookie), "GET", qs.stringify(params), "common");
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
return await http.fetch<BTMuli.User.Response.Tokens>(url, {
method: "GET",
headers: header,