Closed ThomasBaier closed 4 years ago
Hi @ThomasBaier thats really great you’re working on extension like this! Can you please precise your question?
In general I’d suggest just adding a dedicated route inside your module (via router/index you’ve got probably inside the module) and redirect users to this specific url. Inside it you can just redirect (programmatically in JS) the user to any section they wanted
Prerequisites
Hey i'm developing a module for vue storefront which makes different payment options available from payment services. For some payments i use the createOrder Button to go to a third party service like paypal do the payment and then ### come back.
Goal Scenario:
When the user is linked back to the shop, i want to open directly /checkout#payment or Thankyou page to either adjust the payment or tell the user everything worked fine.
My Problem:
I'm looking for best practice to directly when loading the pwa with special parameters rout to /checkout#payment page or the ThankYou Page. or even better go there Without extra work.
My Solution so fare:
link to landing page "home.vue" and give some parameters to analyse if payment success or payment failed. From there trigger Events / State changes to show the checkout#payment page or Thank you page. See example code below.
Code so far in Home.js
mounted () { var url_string = window.location.href var url = new URL(url_string) var a = url.searchParams.get('a') console.log('THB:', a) if (a === '1') { // Success this.$bus.$emit('checkout-after-paymentDetails', {}, {}) } else if (a === '2') { // ERROR this.$router.push(this.localizedRoute('/checkout#payment')) alert('Payment failed.. Please Repeat.') } else if (a === '3') { // back this.$router.push(this.localizedRoute('/checkout#payment')) } } }
Thanks for every help!