Skip to content

Commit

Permalink
feat(premium): add separate check for valid license
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Jul 11, 2020
1 parent a16a090 commit 8c14bca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
17 changes: 8 additions & 9 deletions pages/premium.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
@@ -0,0 +1,172 @@
<template>
<main>
<!-- Control pannel -->
<ControlPannel
v-if="hasValidLicenseKey"
class="h-full min-h-screen mx-auto"
/>

<!-- Log In -->
<div
v-if="!isUserPremium"
class="grid min-h-screen"
style="place-items: center;"
>
<div v-else class="grid min-h-screen" style="place-items: center;">
<div class="w-full max-w-screen-sm">
<!-- Log In form -->
<login />
Expand All @@ -18,9 +20,6 @@
<subscription />
</div>
</div>

<!-- Control pannel -->
<ControlPannel v-else class="h-full min-h-screen mx-auto" />
</main>
</template>

Expand All @@ -34,7 +33,7 @@ export default {
components: { Login, Subscription, ControlPannel },
computed: {
...mapGetters('premium', ['isUserPremium']),
...mapGetters('premium', ['hasValidLicenseKey']),
},
head() {
Expand Down
6 changes: 5 additions & 1 deletion store/premium/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export const state = () => ({
})

export const getters = {
isUserPremium(state, getters, rootState) {
hasValidLicenseKey(state) {
return state.responseData && state.responseData.success === true
},

isUserPremium(state) {
return (
state.responseData &&
state.responseData.success === true &&
Expand Down

0 comments on commit 8c14bca

Please sign in to comment.