get ALL mods at once

This commit is contained in:
SpikeHD
2022-08-25 20:18:58 -07:00
parent 57c1a7800c
commit a7914406b4
2 changed files with 26 additions and 9 deletions

View File

@@ -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[]) {