[+] Maimai api endpoints

pull/10/head
Azalea 2024-02-10 06:30:22 -05:00
parent ee958f20d2
commit 9478da81a9
1 changed files with 11 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import {aqua_host} from "./config";
import type {TrendEntry} from "./generalTypes";
const multTable = [
@ -28,4 +29,14 @@ export async function getMaimai(endpoint: string, params: any) {
method: "POST",
body: JSON.stringify(params)
}).then(res => res.json())
}
export async function getMaimaiApi(endpoint: string, params: any) {
let url = new URL(`${aqua_host}/api/game/maimai2new/${endpoint}`)
Object.keys(params).forEach(key => url.searchParams.append(key, params[key]))
return await fetch(url).then(res => res.json())
}
export async function getMaimaiTrend(userId: number): Promise<TrendEntry[]> {
return await getMaimaiApi("trend", {userId})
}