Skip to content

Commit

Permalink
fix: don't use async await on synchronous code
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Sep 4, 2020
1 parent e47d64a commit 91a0619
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions components/pages/posts/content/PostTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ export default {
methods: {
...mapActions('booru', ['addedTagsManager', 'pidManager', 'fetchPosts']),
async fetchSpecificTag(tag) {
await this.pidManager({ operation: 'reset' })
fetchSpecificTag(tag) {
this.pidManager({ operation: 'reset' })
await this.addedTagsManager({
this.addedTagsManager({
operation: 'reset',
})
await this.addedTagsManager({
this.addedTagsManager({
operation: 'add',
value: tag,
})
Expand Down
8 changes: 4 additions & 4 deletions components/pages/posts/domain/Selector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,18 @@ export default {
'fetchPosts',
]),
async changeDomain(domain) {
changeDomain(domain) {
// Redirect to premium page
if (domain === 'Add booru') {
this.$router.push({ name: 'premium' })
return
}
await this.activeBooruManager({ operation: 'search', value: domain })
this.activeBooruManager({ operation: 'search', value: domain })
await this.pidManager({ operation: 'reset' })
this.pidManager({ operation: 'reset' })
await this.addedTagsManager({ operation: 'reset' })
this.addedTagsManager({ operation: 'reset' })
this.fetchPosts()
Expand Down
4 changes: 2 additions & 2 deletions components/pages/posts/navigation/search/SearchResults.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ export default {
}
},
async fetchAddedTags() {
await this.pidManager({ operation: 'reset' })
fetchAddedTags() {
this.pidManager({ operation: 'reset' })
await this.setSearchIsActive(false)
Expand Down
4 changes: 2 additions & 2 deletions components/pages/posts/util/PostsStartupMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export default {
methods: {
...mapActions('booru', ['fetchPosts', 'pidManager']),

async setInitialPageIDAndFetch() {
setInitialPageIDAndFetch() {
if (this.queries.pid === undefined)
await this.pidManager({ operation: 'reset' })
this.pidManager({ operation: 'reset' })

if (!this.posts.data.length) this.fetchPosts()
},
Expand Down
4 changes: 2 additions & 2 deletions store/booru/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ export const actions = {
)

if (mode === 'concat') {
dispatch('postsManager', { operation: 'concat', value: response })
await dispatch('postsManager', { operation: 'concat', value: response })
} else {
dispatch('postsManager', { operation: 'set', value: response })
await dispatch('postsManager', { operation: 'set', value: response })
}
},

Expand Down

0 comments on commit 91a0619

Please sign in to comment.