mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
♻️ 减少耦合
This commit is contained in:
@@ -7,30 +7,26 @@
|
||||
|
||||
// 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 验证 stoken 有效性,返回 mid
|
||||
* @description 验证 ltoken 有效性,返回 mid
|
||||
* @since Alpha v0.2.0
|
||||
* @param {string} ltoken ltoken
|
||||
* @param {string} ltuid 登录用户 uid
|
||||
* @param {string} stoken stoken
|
||||
* @returns {Promise<string | BTMuli.Genshin.Base.Response>}
|
||||
*/
|
||||
export async function verifyLToken (ltoken: string, ltuid: string, stoken: string): Promise<string | BTMuli.Genshin.Base.Response> {
|
||||
export async function verifyLToken (ltoken: string, ltuid: string): Promise<string | BTMuli.Genshin.Base.Response> {
|
||||
const url = TGApi.GameTokens.verifyLToken;
|
||||
const cookie = {
|
||||
ltoken,
|
||||
ltuid,
|
||||
};
|
||||
const data = { stoken };
|
||||
const header = TGUtils.User.getHeader(transCookie(cookie), "POST", qs.stringify(data), "common");
|
||||
const data = { ltoken };
|
||||
const header = TGUtils.User.getHeader(cookie, "POST", data, "common");
|
||||
console.log("header:", header);
|
||||
return await http.fetch<BTMuli.User.Response.Verify>(url, {
|
||||
method: "POST",
|
||||
|
||||
Reference in New Issue
Block a user