From e7b5ac1fc8bdb56be6d50ec4554ab9dc3276c81e Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 21 Jul 2020 18:46:16 +0200 Subject: [PATCH] Check if localhost before making fetch request. --- frontend/components/stripe.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/components/stripe.vue b/frontend/components/stripe.vue index 5652720..a6178c4 100644 --- a/frontend/components/stripe.vue +++ b/frontend/components/stripe.vue @@ -58,7 +58,11 @@ export default { }) }, makeIntent() { - fetch('/api/stripe/create-payment-intent', { + let url = '/api/stripe/create-payment-intent'; + if (window.location.href.includes('localhost')) + url = 'http://localhost:30010'.concat(url) + + fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json'