chore: clear the mechanical lint and type findings
Dead imports and locals removed, each blocks keyed, `any` narrowed to unknown. Two context setters kept their calls and lost only the unused binding; the settings redirect no longer awaits a parent whose data it discards. A leading underscore now marks a binding that only holds a position.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { addBooksToShelf, createBookshelf, listBookshelves, removeBooksFromShelf } from '$lib/api';
|
||||
import type { Book, Bookshelf } from '$lib/schema';
|
||||
import { getContext, setContext } from 'svelte';
|
||||
@@ -22,7 +22,7 @@ export class BookshelfState {
|
||||
|
||||
async fetchBookshelves(libraryId: string) {
|
||||
try {
|
||||
let paginatedBookshelves = await listBookshelves({
|
||||
const paginatedBookshelves = await listBookshelves({
|
||||
libraries: [libraryId]
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ export class BookshelfState {
|
||||
|
||||
async addBookshelf(name: string, libraryId?: string | number, booksToAdd?: string[] | number[]) {
|
||||
try {
|
||||
let bookshelf = await createBookshelf({
|
||||
const bookshelf = await createBookshelf({
|
||||
title: name,
|
||||
library_id: libraryId,
|
||||
book_ids: booksToAdd
|
||||
@@ -133,7 +133,7 @@ export class BookshelfState {
|
||||
decrementBy++;
|
||||
}
|
||||
});
|
||||
return { ...shelf, total: shelf.total - decrementBy };
|
||||
return { ...shelf, total: (shelf.total ?? 0) - decrementBy };
|
||||
}
|
||||
return shelf;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user