I'm having trouble validating route parameters in my page component using the following code:
async validate({ params, store }) {
await store.dispatch(types.VALIDATE_PARAMS_ASYNC, params.id)
}
And here's the corresponding code in the store:
async [types.VALIDATE_PARAMS_ASYNC]({state, commit, dispatch}, payload) {
try {
const res = await this.$axios.$post('/api/params/validate', {
params: payload
})
commit(types.MUTATE_SET_INFO, res.data) // The mutation is located in another module and isn't working
return true
} catch(e) {
return false
}
}
Despite implementing this logic, it doesn't seem to work as expected. Even with invalid parameters, the page still loads. Any ideas on what might be going wrong? Please assist!