diff --git a/client/src/components/form/Form.tsx b/client/src/components/form/Form.tsx index 655bf3d..8a9f386 100644 --- a/client/src/components/form/Form.tsx +++ b/client/src/components/form/Form.tsx @@ -28,7 +28,7 @@ export default function From({ // Extracting form values through 'name' property, in 'data' const data = Object.fromEntries(formData) - const res = await axios.post(`${ENV.SERVER_URL}/${endpoint}`, data) + const res = await axios.post(`${ENV.SERVER_URL}${endpoint}`, data) console.log(res.data) form.reset() diff --git a/client/src/pages/cart/components/place-order/PlaceOrder.tsx b/client/src/pages/cart/components/place-order/PlaceOrder.tsx index ea6f07e..d16fcc8 100644 --- a/client/src/pages/cart/components/place-order/PlaceOrder.tsx +++ b/client/src/pages/cart/components/place-order/PlaceOrder.tsx @@ -5,6 +5,7 @@ import { useAppSelector } from '@/state/store' import { totalCartPrice } from '@/utils' import toast from 'react-hot-toast' import styles from './PlaceOrder.module.css' +import { ENV } from '@/conf' declare global { interface Window { @@ -24,11 +25,11 @@ export default function PlaceOrder() { const performCheckout = async () => { const { data: { key }, - } = await axios.get('http://www.localhost:5000/api/v1/get-key') + } = await axios.get(`${ENV.SERVER_URL}/get-key`) const { data: { order }, - } = await axios.post('http://localhost:5000/api/v1/checkout', { + } = await axios.post(`${ENV.SERVER_URL}/checkout`, { amount, }) @@ -40,7 +41,7 @@ export default function PlaceOrder() { description: 'Secure payment through RazorPay', // image: '', order_id: order.id, - callback_url: 'http://localhost:5000/api/v1/paymentverification', + callback_url: `${ENV.SERVER_URL}/paymentverification`, notes: { address: 'Razorpay Corporate Office', }, diff --git a/client/src/pages/payment-success/PaymentSuccessPage.tsx b/client/src/pages/payment-success/PaymentSuccessPage.tsx index 174ba4b..ee863cb 100644 --- a/client/src/pages/payment-success/PaymentSuccessPage.tsx +++ b/client/src/pages/payment-success/PaymentSuccessPage.tsx @@ -1,3 +1,4 @@ +import { ENV } from '@/conf' import { clear } from '@/state/slices/cartSlice' import { useAppDispatch } from '@/state/store' import { useEffect } from 'react' @@ -14,7 +15,7 @@ export default function PaymentSuccessPage() { if (referenceNum) { console.log(referenceNum) const response = await fetch( - `http://localhost:5000/api/v1/verify-payment?paymentId=${referenceNum}` + `${ENV.SERVER_URL}/verify-payment?paymentId=${referenceNum}` ) const data = await response.json() if (data.success) {