mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
✨ 帖子收藏 #100
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file web/request/TGRequest.ts
|
||||
* @description 应用用到的请求函数
|
||||
* @since Beta v0.4.3
|
||||
* @since Beta v0.4.5
|
||||
*/
|
||||
|
||||
import { genAuthkey, genAuthkey2 } from "./genAuthkey";
|
||||
@@ -20,6 +20,7 @@ import { getStokenByGameToken, getTokenBySToken } from "./getStoken";
|
||||
import getSyncAvatarDetail from "./getSyncAvatarDetail";
|
||||
import getSyncAvatarListAll from "./getSyncAvatarListAll";
|
||||
import { getTokensByLoginTicket } from "./getTokens";
|
||||
import { getUserCollect } from "./getUserCollect";
|
||||
import { getUserInfoByCookie } from "./getUserInfo";
|
||||
import { verifyLToken } from "./verifyLToken";
|
||||
|
||||
@@ -43,6 +44,7 @@ const TGRequest = {
|
||||
getAbyss,
|
||||
getAccounts: getGameAccountsByCookie,
|
||||
getUserInfo: getUserInfoByCookie,
|
||||
getCollect: getUserCollect,
|
||||
},
|
||||
byLToken: {
|
||||
verify: verifyLToken,
|
||||
|
||||
35
src/web/request/getUserCollect.ts
Normal file
35
src/web/request/getUserCollect.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @file web/request/getUserCollect.ts
|
||||
* @description 获取用户收藏请求模块
|
||||
* @since Beta v0.4.5
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
|
||||
import TGUtils from "../utils/TGUtils";
|
||||
|
||||
/**
|
||||
* @description 获取用户收藏帖子
|
||||
* @since Beta v0.4.5
|
||||
* @param {Record<string, string>} cookie - 用户 cookie
|
||||
* @param {string} offset - 偏移量
|
||||
* @returns {Promise<TGApp.BBS.Collection.PostRespData|TGApp.BBS.Response.Base>} 用户收藏帖子
|
||||
*/
|
||||
export async function getUserCollect(
|
||||
cookie: Record<string, string>,
|
||||
offset: string = "",
|
||||
): Promise<TGApp.BBS.Collection.PostRespData | TGApp.BBS.Response.Base> {
|
||||
const url = "https://bbs-api.miyoushe.com/post/wapi/userFavouritePost";
|
||||
const params = { size: "20", offset };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
return await http
|
||||
.fetch<TGApp.BBS.Collection.PostResponse | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.data.retcode !== 0) return <TGApp.BBS.Response.Base>res.data;
|
||||
return res.data.data;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user