mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-15 08:34:43 +01:00
get ALL mods at once
This commit is contained in:
@@ -118,13 +118,30 @@ interface ModDownload {
|
||||
}
|
||||
|
||||
export async function getMods(mode: string) {
|
||||
const resp = JSON.parse(
|
||||
await invoke('list_submissions', {
|
||||
mode,
|
||||
})
|
||||
)
|
||||
let modList: GamebananaResponse[] = []
|
||||
let hadMods = true
|
||||
let page = 1
|
||||
|
||||
return formatGamebananaData(resp)
|
||||
while (hadMods) {
|
||||
const resp = JSON.parse(
|
||||
await invoke('list_submissions', {
|
||||
mode,
|
||||
page: '' + page,
|
||||
})
|
||||
)
|
||||
|
||||
if (resp.length === 0) hadMods = false
|
||||
|
||||
modList = [...modList, ...resp]
|
||||
page++
|
||||
|
||||
console.log(page)
|
||||
console.log(resp)
|
||||
}
|
||||
|
||||
console.log(modList)
|
||||
|
||||
return formatGamebananaData(modList)
|
||||
}
|
||||
|
||||
export async function formatGamebananaData(obj: GamebananaResponse[]) {
|
||||
|
||||
Reference in New Issue
Block a user