mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-07-12 18:43:45 +00:00
fix(*): Add error handling for no pokedex entries
This commit is contained in:
@@ -32,7 +32,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function fetchCatchRecords() {
|
async function fetchCatchRecords() {
|
||||||
console.log('Fetching catch record data');
|
|
||||||
const response = await fetch('/api/catch-records');
|
const response = await fetch('/api/catch-records');
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error('Failed to fetch catch record data');
|
throw new Error('Failed to fetch catch record data');
|
||||||
@@ -53,6 +52,11 @@
|
|||||||
personalNotes: ''
|
personalNotes: ''
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
if (newCatchRecords.length === 0) {
|
||||||
|
alert('No pokedex entries to create catch records for');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const batchSize = 500;
|
const batchSize = 500;
|
||||||
for (let i = 0; i < newCatchRecords.length; i += batchSize) {
|
for (let i = 0; i < newCatchRecords.length; i += batchSize) {
|
||||||
const batch = newCatchRecords.slice(i, i + batchSize);
|
const batch = newCatchRecords.slice(i, i + batchSize);
|
||||||
|
|||||||
Reference in New Issue
Block a user