diff --git a/src/lib/catalog/db.ts b/src/lib/catalog/db.ts index 57add25..88ee936 100644 --- a/src/lib/catalog/db.ts +++ b/src/lib/catalog/db.ts @@ -1,8 +1,8 @@ -import type { Volume } from '$lib/upload'; +import type { Volume } from '$lib/types'; import Dexie, { type Table } from 'dexie'; export interface Catalog { - id?: number; + id: string; manga: Volume[]; } @@ -12,7 +12,7 @@ export class CatalogDexie extends Dexie { constructor() { super('mokuro'); this.version(1).stores({ - catalog: '++id, manga' + catalog: 'id, manga' }); } } diff --git a/src/lib/catalog/index.ts b/src/lib/catalog/index.ts index b9d86bf..455ad2a 100644 --- a/src/lib/catalog/index.ts +++ b/src/lib/catalog/index.ts @@ -1,5 +1,8 @@ -import type { Volume } from "$lib/upload"; +import type { Volume } from "$lib/types"; import { writable } from "svelte/store"; +import { db } from "$lib/catalog/db"; +import { liveQuery } from "dexie"; export const currentManga = writable(undefined); export const currentVolume = writable(undefined); +export const catalog = liveQuery(() => db.catalog.toArray()); \ No newline at end of file diff --git a/src/lib/catalog/test.ts b/src/lib/catalog/test.ts deleted file mode 100644 index 30c5035..0000000 --- a/src/lib/catalog/test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { writable } from "svelte/store"; -import { db } from "$lib/catalog/db"; -import type { Volume } from "$lib/upload"; -import { liveQuery } from "dexie"; - - - - -export const catalog = liveQuery(() => db.catalog.toArray()); diff --git a/src/lib/components/Catalog.svelte b/src/lib/components/Catalog.svelte index 61b7777..c9bbef1 100644 --- a/src/lib/components/Catalog.svelte +++ b/src/lib/components/Catalog.svelte @@ -1,5 +1,5 @@ diff --git a/src/lib/components/CatalogItem.svelte b/src/lib/components/CatalogItem.svelte index c5d8497..3f3814b 100644 --- a/src/lib/components/CatalogItem.svelte +++ b/src/lib/components/CatalogItem.svelte @@ -1,6 +1,6 @@