diff --git a/src/mlpccg/database.ts b/src/mlpccg/database.ts index a9dd537..c4b9aae 100644 --- a/src/mlpccg/database.ts +++ b/src/mlpccg/database.ts @@ -1,10 +1,10 @@ import Dexie from "dexie"; -import { Card, CardFilter, StoredImages } from "./types"; +import { Card, CardFilter, StoredImage } from "./types"; import { cardFullName } from "./card"; class CardDatabase extends Dexie { public cards: Dexie.Table; - public images: Dexie.Table; + public images: Dexie.Table; public constructor() { super("CardDatabase"); @@ -155,6 +155,9 @@ export async function getCards(filter: CardFilter) { } export async function cardFromIDs(cardIDs: string[]): Promise { + if (Database == null) { + throw new Error("Database was not initialized, init with 'initDB()'"); + } let table = Database.cards; //TODO Replace with .bulkGet when upgrading to Dexie 3.x return await table diff --git a/src/mlpccg/types.ts b/src/mlpccg/types.ts index 7a8e6d3..85e1b4c 100644 --- a/src/mlpccg/types.ts +++ b/src/mlpccg/types.ts @@ -2,7 +2,7 @@ export type Rarity = "C" | "U" | "R" | "SR" | "UR" | "RR"; export type PowerRequirement = { [key: string]: number }; -export interface StoredImages { +export interface StoredImage { id: string; image: Blob; }