From bf1ee57d78e32fed5825c6c465bcdfa8785108ee Mon Sep 17 00:00:00 2001 From: Alejandro Akbal <37181533+AlejandroAkbal@users.noreply.github.com> Date: Mon, 8 May 2023 12:17:48 +0200 Subject: [PATCH] fix: add API changes --- store/booru.js | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/store/booru.js b/store/booru.js index 999e94c5..2c461aaa 100644 --- a/store/booru.js +++ b/store/booru.js @@ -287,30 +287,31 @@ export const actions = { { root: true } ) - // Filter out posts - response.data = response.data.filter((post) => { - if (!post.high_res_file?.url) { - return false - } - - if (post.media_type === 'unknown') { - return false - } + const POSTS = response.data.data + // Filter out posts that don't have a file or media type + .filter((post) => { + if (!post.high_res_file?.url) { + return false + } - return true - }) + if (post.media_type === 'unknown') { + return false + } - // This is how a final booru object looks like - const POSTS = response.data.map((POST) => { - return { - id: `${ACTIVE_BOORU_DOMAIN}-${POST.id}`, - data: POST, - meta_data: { - booru_domain: ACTIVE_BOORU_DOMAIN, - created_at: null + return true + }) + + // This is how a final booru object looks like + .map((POST) => { + return { + id: `${ACTIVE_BOORU_DOMAIN}-${POST.id}`, + data: POST, + meta_data: { + booru_domain: ACTIVE_BOORU_DOMAIN, + created_at: null + } } - } - }) + }) if (mode === 'concat') { await dispatch('postsManager', { operation: 'concat', value: POSTS }) @@ -344,7 +345,7 @@ export const actions = { ) // This is how a final Booru Tag object looks like - const TAGS = response.data.map((TAG) => { + const TAGS = response.data.data.map((TAG) => { return { id: `${ACTIVE_BOORU_DOMAIN}-${TAG.name}`, name: TAG.name,