mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-17 10:08:14 +08:00
refactor(Mys): request 跟 utils 拿出来了
This commit is contained in:
31
src/plugins/Mys/request/gacha.ts
Normal file
31
src/plugins/Mys/request/gacha.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @file plugins Mys request gacha.ts
|
||||
* @description Mys抽卡请求
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @since Alpha
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
import { GachaResponse, GachaData } from "../interface/gacha";
|
||||
|
||||
// 卡池 API
|
||||
const GACHA_POOL_API =
|
||||
"https://api-takumi.mihoyo.com/common/blackboard/ys_obc/v1/gacha_pool?app_sn=ys_obc";
|
||||
|
||||
/**
|
||||
* @description 获取卡池信息
|
||||
* @since Alpha
|
||||
* @return {Promise<GachaData[]>}
|
||||
*/
|
||||
export async function getGachaData(): Promise<GachaData[]> {
|
||||
return await http
|
||||
.fetch<GachaResponse>(GACHA_POOL_API, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(res => {
|
||||
return res.data.data.list;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user