fix: the data saved may be incomplete if the api does not return data (#28)

This commit is contained in:
mio 2023-05-18 01:44:59 +08:00
parent 82f42e56db
commit 298ea3e053
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "star-rail-warp-export",
"version": "0.0.17",
"version": "0.0.18",
"main": "./dist/electron/main/main.js",
"author": "biuuu <https://github.com/biuuu>",
"license": "MIT",

View File

@ -163,7 +163,10 @@ const getGachaLog = async ({ key, page, name, retryCount, url, endId }) => {
const text = i18n.log
try {
const res = await request(`${url}&gacha_type=${key}&page=${page}&size=${20}${endId ? '&end_id=' + endId : ''}`)
return res?.data
if (res?.data?.list) {
return res?.data
}
throw new Error(res?.message || res)
} catch (e) {
if (retryCount) {
sendMsg(i18n.parse(text.fetch.retry, { name, page, count: 6 - retryCount }))