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

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

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