✏️ 继续修正 import

This commit is contained in:
目棃
2024-06-26 22:28:05 +08:00
parent f2e4186042
commit 0061dfa988
44 changed files with 198 additions and 230 deletions

View File

@@ -5,9 +5,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 验证 ltoken 有效性,返回 mid
@@ -21,20 +22,13 @@ export async function verifyLToken(
ltuid: string,
): Promise<string | TGApp.BBS.Response.Base> {
const url = TGApi.GameTokens.verifyLToken;
const cookie = {
ltoken,
ltuid,
};
const cookie = { ltoken, ltuid };
const data = { ltoken };
const header = TGUtils.User.getHeader(cookie, "POST", data, "common");
return await http
.fetch<TGApp.BBS.Response.verifyUserInfoBySToken | TGApp.BBS.Response.Base>(url, {
method: "POST",
headers: header,
body: http.Body.json(data),
})
.then((res) => {
if (res.data.retcode !== 0) return res.data;
.fetch(url, { method: "POST", headers: header, body: http.Body.json(data) })
.then((res: Response<TGApp.BBS.Response.verifyUserInfoBySToken | TGApp.BBS.Response.Base>) => {
if (res.data.retcode !== 0) return <TGApp.BBS.Response.Base>res.data;
return res.data.data.user_info.mid;
});
}