🐛 修复nav返回数据为空或者缺失

This commit is contained in:
目棃
2024-07-23 13:07:43 +08:00
parent 27a2e93efc
commit 7391752247

View File

@@ -1,23 +1,24 @@
/**
* @file plugins/Mys/request/getHomeNavigator.ts
* @description Mys 插件首页导航请求
* @since Beta v0.5.0
* @since Beta v0.5.1
*/
import TGHttp from "../../../utils/TGHttp.js";
/**
* @description 获取首页导航列表
* @since Beta v0.5.0
* @since Beta v0.5.1
* @param {number} gid GID
* @return {Promise<TGApp.BBS.Navigator.Navigator[]>}
*/
async function getHomeNavigator(gid: number = 2): Promise<TGApp.BBS.Navigator.Navigator[]> {
const url = "https://bbs-api.miyoushe.com/apihub/api/home/new";
const params = { gids: gid.toString() };
const header = { "x-rpc-client_type": "2" };
const resp = await TGHttp<TGApp.BBS.Navigator.HomeResponse>(url, {
method: "GET",
headers: { "Content-Type": "application/json" },
headers: header,
query: params,
});
return resp.data.navigator;