Skip to content

Commit

Permalink
feat: filter out bad Posts
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Apr 11, 2023
1 parent 6c3fb67 commit 709e5d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
16 changes: 0 additions & 16 deletions components/pages/posts/post/PostMedia.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,6 @@ export default {
Intersect
},
created() {
if (!this.isVideo && !this.isImage) {
const message = 'Unknown media type'
this.error.message = message
this.error.show = true
}
if (!this.mediaSrc) {
const message = 'No media available'
this.error.message = message
this.error.show = true
}
},
props: {
mediaSrc: {
type: String,
Expand Down
13 changes: 13 additions & 0 deletions store/booru.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,19 @@ 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
}

return true
})

// This is how a final booru object looks like
const POSTS = response.data.map((POST) => {
return {
Expand Down

0 comments on commit 709e5d7

Please sign in to comment.