Skip to content

Commit

Permalink
add env toggle in checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
RookieProgrammerSachin committed Jan 5, 2024
1 parent 8a32a5f commit 8eff14c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function Payments() {
const manageOrders = async () => {
const params = new URLSearchParams({
pageNo: pageNo,
pageSize: 200,
pageSize: 250,
});
const response = await axios.get(
"https://spring-madrasda-2f6mra4vwa-em.a.run.app/api/transaction/manageOrders?" +
Expand Down
9 changes: 6 additions & 3 deletions src/pages/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import {
} from "@mui/material";
import CartItem from "@/components/CartItem";

const ENV = "prod";
const API_URL = ENV == "prod"? "https://spring-madrasda-2f6mra4vwa-em.a.run.app": "https://16gf53qw-8080.inc1.devtunnels.ms"

export default function Checkout() {
const [subTotal, setSubtotal] = React.useState(0);
const [shippingCharges, setShippingCharges] = useState(-1);
Expand Down Expand Up @@ -91,7 +94,7 @@ export default function Checkout() {
axios
.get(
// spring-madrasda-2f6mra4vwa-em.a.run.app
"https://spring-madrasda-2f6mra4vwa-em.a.run.app/api/payment/getShippingCharges/" +
API_URL + "/api/payment/getShippingCharges/" +
text,
{
headers: {
Expand All @@ -116,7 +119,7 @@ export default function Checkout() {
}
});
};

// https://spring-madrasda-2f6mra4vwa-em.a.run.app/api/webhook/updateShipmentStatus
const handleChange = (event) => {
const text = event.target.value;
const pincodeRegex = /^[1-9][0-9]{5}$/;
Expand Down Expand Up @@ -179,7 +182,7 @@ export default function Checkout() {
.post(
//https://spring-madrasda-2f6mra4vwa-em.a.run.app
//http://localhost:8080
"https://spring-madrasda-2f6mra4vwa-em.a.run.app/api/payment/createOrder",
API_URL + "/api/payment/createOrder",
transaction,
{
headers: {
Expand Down
3 changes: 0 additions & 3 deletions src/pages/login.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Head from "next/head";
import { forwardRef, useContext, useEffect, useRef, useState } from "react";
import axios from "axios";
import { getRole, isTokenValid } from "@/utils/JWTVerifier";
import Image from "next/image";
import Otp from "@/components/Otp";
import Login from "@/components/Login";
Expand All @@ -17,8 +16,6 @@ const Alert = forwardRef(function Alert(props, ref) {
export default function LoginForm() {
const router = useRouter();
let isReady = router.isReady;
const [details, setDetails] = useState(null);
const [designs, setDesigns] = useState(null);
const [loading, setLoading] = useState(false);
const [spinner, setSpinnerState] = useState(false); //spinner
const phoneRef = useRef();
Expand Down

0 comments on commit 8eff14c

Please sign in to comment.