Skip to content

Commit

Permalink
Remove keep-alive tag. Update cart after checkout.
Browse files Browse the repository at this point in the history
  • Loading branch information
scottyzen committed Jan 17, 2022
1 parent 2d55df4 commit 0b9d45a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<transition name="slide">
<MobileMenu v-if="showMenu" class="z-50" />
</transition>
<Nuxt class="flex-1" keek-alive />
<Nuxt class="flex-1" />
<transition name="page">
<div
v-if="showCart || showMenu"
Expand Down
1 change: 1 addition & 0 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export default defineNuxtConfig({
publicRuntimeConfig: {
perPage: 12,
clientVersion: pkg.version,
stripePublishableKey: process.env.STRIPE_PUBLISHABLE_KEY,
},

router: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "woonuxt",
"version": "0.3.14",
"version": "0.3.15",
"private": true,
"scripts": {
"dev": "nuxi dev",
Expand Down
16 changes: 12 additions & 4 deletions pages/checkout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@
<BillingDetails :billing="billing" />

<div>
<label for>Credit Card</label>
<label class="flex justify-between" for>
Credit Card
<span
class="text-sm text-orange-400 capitalize"
>Test mode: 4242 4242 4242 4242</span>
</label>
<StripeElements
v-if="loadStripe"
class="w-full"
:stripe-key="'pk_test_PnccujKJJqnELQBTdWpHx5s900OzMpEh6o'"
:stripe-key="$config.stripePublishableKey"
:instance-options="{}"
:elements-options="{}"
#default="{ elements }"
Expand All @@ -63,6 +68,7 @@
<script>
import { StripeElements, StripeElement } from 'vue-stripe-elements-plus'
import CHECKOUT from '~/gql/mutations/checkout';
import GET_CART from '~/gql/queries/getCart';
export default {
data() {
Expand Down Expand Up @@ -116,9 +122,11 @@ export default {
const { checkout } = await this.$graphql.default.request(CHECKOUT, variables)
if (checkout.result == 'success') {
this.buttonText = 'Order Successfull';
setTimeout(() => {
const { cart, viewer, customer } = await this.$graphql.default.request(GET_CART);
this.$store.commit('updateCart', cart);
if (cart) {
this.$router.push('/order/' + checkout.order.databaseId)
}, 600);
}
} else {
this.buttonText = 'Place Order';
}
Expand Down

0 comments on commit 0b9d45a

Please sign in to comment.