[FA-misc] Resolve lint issues
This commit is contained in:
@@ -33,10 +33,10 @@
|
|||||||
let error: string | null = $state(null);
|
let error: string | null = $state(null);
|
||||||
|
|
||||||
// Track which lists the novel is in (by list ID)
|
// Track which lists the novel is in (by list ID)
|
||||||
let novelInLists = $state(new SvelteSet<number>());
|
let novelInLists = new SvelteSet<number>();
|
||||||
|
|
||||||
// Track loading state for individual list toggles
|
// Track loading state for individual list toggles
|
||||||
let loadingListIds = $state(new SvelteSet<number>());
|
let loadingListIds = new SvelteSet<number>();
|
||||||
|
|
||||||
// Quick-create state
|
// Quick-create state
|
||||||
let showQuickCreate = $state(false);
|
let showQuickCreate = $state(false);
|
||||||
@@ -75,13 +75,12 @@
|
|||||||
if (result.data) {
|
if (result.data) {
|
||||||
readingLists = result.data.readingLists;
|
readingLists = result.data.readingLists;
|
||||||
// Build the set of list IDs that contain this novel
|
// Build the set of list IDs that contain this novel
|
||||||
const inLists = new SvelteSet<number>();
|
novelInLists.clear();
|
||||||
for (const list of readingLists) {
|
for (const list of readingLists) {
|
||||||
if (list.items.some((item) => item.novelId === novelId)) {
|
if (list.items.some((item) => item.novelId === novelId)) {
|
||||||
inLists.add(list.id);
|
novelInLists.add(list.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
novelInLists = inLists;
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e instanceof Error ? e.message : 'Failed to load reading lists';
|
error = e instanceof Error ? e.message : 'Failed to load reading lists';
|
||||||
@@ -92,7 +91,7 @@
|
|||||||
|
|
||||||
async function toggleNovelInList(listId: number) {
|
async function toggleNovelInList(listId: number) {
|
||||||
const isInList = novelInLists.has(listId);
|
const isInList = novelInLists.has(listId);
|
||||||
loadingListIds = new SvelteSet([...loadingListIds, listId]);
|
loadingListIds.add(listId);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (isInList) {
|
if (isInList) {
|
||||||
@@ -115,7 +114,7 @@
|
|||||||
|
|
||||||
if (result.data?.removeFromReadingList?.readingListPayload?.success) {
|
if (result.data?.removeFromReadingList?.readingListPayload?.success) {
|
||||||
// Update local state
|
// Update local state
|
||||||
novelInLists = new SvelteSet([...novelInLists].filter((id) => id !== listId));
|
novelInLists.delete(listId);
|
||||||
// Update item count in list
|
// Update item count in list
|
||||||
readingLists = readingLists.map((list) =>
|
readingLists = readingLists.map((list) =>
|
||||||
list.id === listId
|
list.id === listId
|
||||||
@@ -143,7 +142,7 @@
|
|||||||
|
|
||||||
if (result.data?.addToReadingList?.readingListPayload?.success) {
|
if (result.data?.addToReadingList?.readingListPayload?.success) {
|
||||||
// Update local state
|
// Update local state
|
||||||
novelInLists = new SvelteSet([...novelInLists, listId]);
|
novelInLists.add(listId);
|
||||||
// Update item count in list
|
// Update item count in list
|
||||||
readingLists = readingLists.map((list) =>
|
readingLists = readingLists.map((list) =>
|
||||||
list.id === listId
|
list.id === listId
|
||||||
@@ -159,7 +158,7 @@
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e instanceof Error ? e.message : 'An error occurred';
|
error = e instanceof Error ? e.message : 'An error occurred';
|
||||||
} finally {
|
} finally {
|
||||||
loadingListIds = new SvelteSet([...loadingListIds].filter((id) => id !== listId));
|
loadingListIds.delete(listId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +217,7 @@
|
|||||||
items: [{ novelId, order: 0, addedTime: new Date().toISOString() }]
|
items: [{ novelId, order: 0, addedTime: new Date().toISOString() }]
|
||||||
};
|
};
|
||||||
readingLists = [...readingLists, fullNewList];
|
readingLists = [...readingLists, fullNewList];
|
||||||
novelInLists = new SvelteSet([...novelInLists, newList.id]);
|
novelInLists.add(newList.id);
|
||||||
|
|
||||||
// Reset quick-create form
|
// Reset quick-create form
|
||||||
showQuickCreate = false;
|
showQuickCreate = false;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ if (token) {
|
|||||||
} else {
|
} else {
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
|
||||||
if (result.errors?.some((e: any) => e.extensions?.code === 'AUTH_NOT_AUTHENTICATED')) {
|
if (result.errors?.some((e: { extensions?: { code?: string } }) => e.extensions?.code === 'AUTH_NOT_AUTHENTICATED')) {
|
||||||
authFailed = true;
|
authFailed = true;
|
||||||
} else if (result.data?.chapter) {
|
} else if (result.data?.chapter) {
|
||||||
chapter = result.data.chapter;
|
chapter = result.data.chapter;
|
||||||
|
|||||||
Reference in New Issue
Block a user