mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-07-13 02:53:45 +00:00
chore(*): Clean up migration artifacts and optimize data repository queries
This commit is contained in:
@@ -99,7 +99,6 @@
|
||||
};
|
||||
|
||||
try {
|
||||
// Use enhanced fetch that includes authentication context
|
||||
const response = await fetch('/api/catch-records', requestOptions);
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
@@ -107,6 +106,9 @@
|
||||
alert('Failed to update catch record');
|
||||
throw new Error('Failed to update catch record');
|
||||
}
|
||||
|
||||
// Refresh the data to reflect changes from server
|
||||
await getData(false);
|
||||
} catch (error) {
|
||||
console.error('Error updating catch record:', error);
|
||||
}
|
||||
@@ -226,13 +228,11 @@
|
||||
|
||||
const createdRecords = await response.json();
|
||||
totalRecordsCreated += createdRecords.length;
|
||||
console.log(`Created ${createdRecords.length} catch records`);
|
||||
} catch (error) {
|
||||
console.error('Error creating catch records:', error);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Created catch records for each pokedex entry');
|
||||
creatingRecords = false;
|
||||
failedToLoad = false;
|
||||
await getData();
|
||||
@@ -292,6 +292,7 @@
|
||||
bind:creatingRecords
|
||||
bind:totalRecordsCreated
|
||||
bind:failedToLoad
|
||||
userId={localUser?.id}
|
||||
{updateACatch}
|
||||
{createCatchRecords}
|
||||
/>
|
||||
|
||||
@@ -16,18 +16,22 @@
|
||||
onDestroy(unsubscribe);
|
||||
|
||||
async function getUser() {
|
||||
const {
|
||||
data: { session }
|
||||
} = await supabase.auth.getSession();
|
||||
try {
|
||||
const {
|
||||
data: { session }
|
||||
} = await supabase.auth.getSession();
|
||||
|
||||
if (session) {
|
||||
localUser = session.user;
|
||||
} else {
|
||||
localUser = null;
|
||||
if (session) {
|
||||
localUser = session.user;
|
||||
user.set(localUser);
|
||||
await goto('/mydex', { replace: true });
|
||||
} else {
|
||||
localUser = null;
|
||||
user.set(localUser);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error getting user session:', error);
|
||||
}
|
||||
|
||||
user.set(localUser);
|
||||
goto('/mydex', { replace: true });
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user