From d90284a269f4e857ac6be471d9996b20a79c5c8a Mon Sep 17 00:00:00 2001 From: ogerly Date: Sun, 20 Mar 2022 13:39:11 +0100 Subject: [PATCH] add store.state and store.commit redeemCode, add store.commit in register --- frontend/src/pages/Register.vue | 41 ++++++++++++++++++++++++++++++--- frontend/src/store/store.js | 5 ++++ 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/Register.vue b/frontend/src/pages/Register.vue index 609182765..5638159b8 100755 --- a/frontend/src/pages/Register.vue +++ b/frontend/src/pages/Register.vue @@ -118,12 +118,37 @@ {{ messageError }} - + + + +
+ + + + + + +
+
+
+ + {{ $t('publisher.publisherId') }} {{ $store.state.publisherId }} + @@ -136,7 +161,7 @@ type="text" placeholder="Publisher ID" v-model="publisherId" - @input="commitStore(publisherId)" + @input="commitStorePublisherId(publisherId)" >
{ @@ -267,5 +297,10 @@ export default { return !(this.namesFilled && this.emailFilled && this.form.agree && !!this.language) }, }, + created() { + if (this.$route.params.code) { + this.commitStoreRedeemCode(this.$route.params.code) + } + }, } diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index 458c8c8de..fb74624fb 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -47,6 +47,9 @@ export const mutations = { hasElopage: (state, hasElopage) => { state.hasElopage = hasElopage }, + redeemCode: (state, redeemCode) => { + state.redeemCode = redeemCode + }, } export const actions = { @@ -73,6 +76,7 @@ export const actions = { commit('hasElopage', false) commit('publisherId', null) commit('isAdmin', false) + commit('redeemCode', null) localStorage.clear() }, } @@ -102,6 +106,7 @@ try { }, hasElopage: false, publisherId: null, + redeemCode: null, }, getters: {}, // Syncronous mutation of the state