Skip to content

Commit eaa6697

Browse files
author
m.navarro
committed
Added check status before enter route
1 parent 2b69f0a commit eaa6697

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/App.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ export default {
7878
mounted() {
7979
this.snackbar = false
8080
},
81-
async beforeMount() {
82-
await this.$store.dispatch('checkPaid')
83-
},
8481
methods: {
8582
goToPrizes() {
8683
this.snackbar = false

src/router.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ router.beforeEach(async (to, from, next) => {
5252
store.dispatch('openLoginDialog')
5353
next({ name: 'home' })
5454
} else if (to.matched.some(record => record.meta.requiresPaid)) {
55+
if (!store.getters.hasPaid && store.getters.isLoading) {
56+
await store.dispatch('checkPaid')
57+
}
5558
if (!store.getters.hasPaid) {
5659
next({ name: 'home' })
5760
store.commit('setSidebar', false)

src/store/modules/payStatus.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { captureException } from '@sentry/browser'
44
export default {
55
state: {
66
paid: false,
7-
loading: false,
7+
loading: true,
88
},
99
mutations: {
1010
setPaid: (state, status) => (state.paid = status),

0 commit comments

Comments
 (0)