Skip to content

Commit

Permalink
fix: use request data instead of vuex data
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Oct 17, 2021
1 parent 635dd1a commit 8b0a1ae
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions middleware/FixPostsRoute.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { RouterHelper } from '~/assets/js/RouterHelper'

function isRouteNotCorrect(context) {
const URL_DOMAIN = context.store.getters['url/urlDomain']
const URL_PAGE = context.store.getters['url/urlPage']
// Fix: we use the query's data since Vuex has not been updated yet with the request data.
const URL_DOMAIN = context.query.domain
const URL_PAGE = context.query.domain

return URL_DOMAIN === undefined || URL_PAGE === undefined
}

function generateCorrectRoute(context) {
const URL_DOMAIN = context.store.getters['url/urlDomain']
const URL_PAGE = context.store.getters['url/urlPage']
const URL_TAGS = context.store.getters['url/urlTags']
// Fix: we use the query's data since Vuex has not been updated yet with the request data.
const URL_DOMAIN = context.query.domain
const URL_PAGE = context.query.page
const URL_TAGS = context.query.tags

return RouterHelper.generatePostsRouteWithDefaults(
context.store,
Expand Down

0 comments on commit 8b0a1ae

Please sign in to comment.