Skip to content

Commit

Permalink
fix: add API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed May 8, 2023
1 parent 159da05 commit bf1ee57
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions store/booru.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit bf1ee57

Please sign in to comment.