md-y/mangadex-full-api

MFA.Cover.getMultiple doesn't work

Closed this issue · 3 comments

When making a request to get many covers using MFA.Cover.getMultiple, I get this as a response:
APIRequestError: Returned HTML error page [object Object]
I can provide more details if necessary.

md-y commented

I can't replicate the issue. What exactly are you doing?

Here's a minimal example that replicates the issue:

const MFA = require('mangadex-full-api');

MFA.login('username', 'password', '.mangadex_search_cache').then(async () => {
    let results = await MFA.Manga.search({
        includedTags: ['ace04997-f6bd-436e-b261-779182193d3d'], // Isekai
        availableTranslatedLanguage: ['en'],
        limit: Infinity
    });

    let covers = await MFA.Cover.getMultiple(results.map(manga => manga.mainCover.id));
}).catch(console.error);
md-y commented
let covers = await MFA.Cover.getMultiple(results.map(manga => manga.mainCover.id));

Should Be:

let covers = await MFA.Cover.getMultiple(...results.map(manga => manga.mainCover.id));

However I'll make it so next version spread operators will flatten arrays so this doesn't happen