mirror of https://github.com/hykilpikonna/AquaDX
[O] Get userid dynamically
parent
6690c665dd
commit
66034ea407
|
@ -10,6 +10,6 @@
|
||||||
<Router {url}>
|
<Router {url}>
|
||||||
<div>
|
<div>
|
||||||
<Route path="/"><Home /></Route>
|
<Route path="/"><Home /></Route>
|
||||||
<Route path="/mai/rating"><MaimaiRating /></Route>
|
<Route path="/u/:userId/mai/rating" component={MaimaiRating}></Route>
|
||||||
</div>
|
</div>
|
||||||
</Router>
|
</Router>
|
||||||
|
|
|
@ -3,6 +3,22 @@
|
||||||
import {getMaimai, getMult} from "../libs/maimai";
|
import {getMaimai, getMult} from "../libs/maimai";
|
||||||
import type {ParsedRating, Rating} from "../libs/maimaiTypes";
|
import type {ParsedRating, Rating} from "../libs/maimaiTypes";
|
||||||
|
|
||||||
|
export let userId: any
|
||||||
|
userId = +userId
|
||||||
|
|
||||||
|
if (!userId) console.error("No user ID provided")
|
||||||
|
else {
|
||||||
|
getMaimai("GetUserRatingApi", {userId}).then(it => {
|
||||||
|
data = it
|
||||||
|
parseRatings()
|
||||||
|
})
|
||||||
|
|
||||||
|
fetch(`${data_host}/maimai/meta/00/all-music.json`).then(it => it.json()).then(it => {
|
||||||
|
musicInfo = it
|
||||||
|
parseRatings()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function parseRatings() {
|
function parseRatings() {
|
||||||
if (!data || !musicInfo) return
|
if (!data || !musicInfo) return
|
||||||
parsedRatings = {
|
parsedRatings = {
|
||||||
|
@ -44,16 +60,6 @@
|
||||||
} | null = null
|
} | null = null
|
||||||
|
|
||||||
let musicInfo: any = null
|
let musicInfo: any = null
|
||||||
|
|
||||||
getMaimai("GetUserRatingApi", {userId: 61702139}).then(it => {
|
|
||||||
data = it
|
|
||||||
parseRatings()
|
|
||||||
})
|
|
||||||
|
|
||||||
fetch(`${data_host}/maimai/meta/00/all-music.json`).then(it => it.json()).then(it => {
|
|
||||||
musicInfo = it
|
|
||||||
parseRatings()
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Display all parsed ratings -->
|
<!-- Display all parsed ratings -->
|
||||||
|
|
Loading…
Reference in New Issue