Handle checking for deck correctly

This commit is contained in:
Mani Batra 2023-03-27 23:03:57 +11:00
parent f3f8d546ff
commit b3560b6ab8
No known key found for this signature in database
GPG key ID: FF32E7D7BF60D915

View file

@ -159,10 +159,8 @@ export default class FlashcardGeneratorPlugin extends Plugin {
async getDeckId(name: string) {
try {
const decks = await this.invokeAnkiConnect("deckNamesAndIds");
for (const deck of decks) {
if (deck.name === name) {
return deck.id;
}
if (decks[name]) {
return decks[name];
}
} catch (error) {
console.error(error);