Refactored for GET request success/failure
parent
c6765dab09
commit
b10002dcc7
|
@ -30,9 +30,10 @@ export default async function fetchLatestHandiworkURLs(query: LatestSearchQuery,
|
|||
const response = await fetchGETResponse(url);
|
||||
|
||||
// Save the URLs
|
||||
if (response.isSuccess()) {
|
||||
//@ts-ignore
|
||||
for(const result of response.data.msg.data) {
|
||||
if(fetchedResults < limit) {
|
||||
for (const result of response.value.data.msg.data) {
|
||||
if (fetchedResults < limit) {
|
||||
const gameURL = new URL(result.thread_id, threadURL).href;
|
||||
resultURLs.push(gameURL);
|
||||
fetchedResults += 1;
|
||||
|
@ -43,7 +44,8 @@ export default async function fetchLatestHandiworkURLs(query: LatestSearchQuery,
|
|||
page += 1;
|
||||
|
||||
//@ts-ignore
|
||||
if (page > response.data.msg.pagination.total) noMorePages = true;
|
||||
if (page > response.value.data.msg.pagination.total) noMorePages = true;
|
||||
} else throw response.value;
|
||||
}
|
||||
while (fetchedResults < limit && !noMorePages);
|
||||
|
||||
|
|
Loading…
Reference in New Issue