Skip to content

Commit

Permalink
Made email optional
Browse files Browse the repository at this point in the history
  • Loading branch information
MrNaif2018 committed Mar 7, 2021
1 parent c2d2b75 commit 29062dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions components/Checkout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
label.label(for="email") Email
.control.has-icons-left.has-icons-right
input.input#email(type="email",
required,
:required="emailRequired",
placeholder="[email protected]",
name="email",
@input="setUserEmail($event.target.value)"
v-validate="'required|email'",
v-validate="'email'",
:class="{ 'is-danger': errors.has('email') }")
span.icon.is-small.is-left
i.fa.fa-envelope
Expand Down Expand Up @@ -66,6 +66,7 @@ export default {
computed: {
...mapGetters("checkout", ["isStripeCardCompleted", "status", "isLoading"]),
...mapGetters("cart", ["userEmail"]),
...mapGetters(["emailRequired"]),
},
methods: {
...mapActions("cart", [
Expand Down
14 changes: 8 additions & 6 deletions store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const state = () => ({
currentPage: 1,
url: "",
services: {},
policies: {},
path: "/",
onion: false,
storeID: 1,
Expand Down Expand Up @@ -34,6 +35,9 @@ export const mutations = {
onion(state, val) {
state.onion = val
},
policies(state, val) {
state.policies = val
},
}
export const getters = {
url: ({ url }) => url,
Expand All @@ -48,16 +52,14 @@ export const getters = {
apiURL({ onion, env }, { apiOnionURL }) {
return onion && apiOnionURL ? apiOnionURL : env.URL
},
emailRequired: ({ policies }) => policies.email_required,
}
export const actions = {
async nuxtServerInit({ commit, dispatch }, { req, $axios, params }) {
await dispatch("loadEnv", { env: this.$config, req })
let storeID
if (params.id) storeID = params.id
else {
const { data } = await $axios.get("/manage/stores")
storeID = data.pos_id
}
const { data } = await $axios.get("/manage/stores")
commit("policies", data)
const storeID = params.id ? params.id : data.pos_id
commit("storeID", storeID)
const { data: services } = await $axios.get("/services")
commit("services", services)
Expand Down

0 comments on commit 29062dd

Please sign in to comment.