Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit e990e40

Browse files
author
Arpitkumar Chaudhari
committed
Fixing Stripe Key, fixing teamObject and Updating logic for rates selection.
1 parent 112273f commit e990e40

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

config/dev.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,4 @@ module.exports = {
1313
V5: "https://api.topcoder-dev.com/v5", //"http://localhost:3030/api/v5"
1414
V3: "https://api.topcoder-dev.com/v3",
1515
},
16-
17-
STRIPE_PUBLIC_KEY: "",
1816
};

config/prod.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,4 @@ module.exports = {
1313
V5: "https://api.topcoder.com/v5",
1414
V3: "https://api.topcoder.com/v3",
1515
},
16-
17-
STRIPE_PUBLIC_KEY: "",
1816
};

src/routes/CreateNewTeam/components/SubmitContainer/index.jsx

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -115,29 +115,32 @@ function SubmitContainer({
115115

116116
setTeamDetailsOpen(false);
117117
setTeamObject(teamObject);
118-
requestTeam();
118+
requestTeam(teamObject);
119119
};
120120

121-
const requestTeam = useCallback(() => {
122-
setRequestLoading(true);
123-
if (matchingRole.isExternalMember) {
124-
dispatch(addTeamObjects(teamObject));
125-
navigate("/taas/myteams/createnewteam/create-taas-payment");
126-
} else {
127-
postTeamRequest(teamObject)
128-
.then(() => {
129-
setTimeout(() => {
130-
dispatch(clearSearchedRoles());
131-
// Backend api create project has sync issue, so delay 2 seconds
132-
navigate("/taas/myteams");
133-
}, 2000);
134-
})
135-
.catch((err) => {
136-
setRequestLoading(false);
137-
toastr.error("Error Requesting Team", err.message);
138-
});
139-
}
140-
}, [dispatch, teamObject]);
121+
const requestTeam = useCallback(
122+
(teamObject) => {
123+
setRequestLoading(true);
124+
if (matchingRole.isExternalMember) {
125+
dispatch(addTeamObjects(teamObject));
126+
navigate("/taas/myteams/createnewteam/create-taas-payment");
127+
} else {
128+
postTeamRequest(teamObject)
129+
.then(() => {
130+
setTimeout(() => {
131+
dispatch(clearSearchedRoles());
132+
// Backend api create project has sync issue, so delay 2 seconds
133+
navigate("/taas/myteams");
134+
}, 2000);
135+
})
136+
.catch((err) => {
137+
setRequestLoading(false);
138+
toastr.error("Error Requesting Team", err.message);
139+
});
140+
}
141+
},
142+
[dispatch, teamObject]
143+
);
141144

142145
return (
143146
<div styleName="page">

src/routes/CreateNewTeam/pages/CreateTaasPayment/index.jsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { loadStripe } from "@stripe/stripe-js";
55
import { ThemeProvider } from "@material-ui/styles";
66
import { toastr } from "react-redux-toastr";
77

8-
import config from "../../../../../config";
98
import PaymentForm from "./PaymentForm";
109
import PageHeader from "components/PageHeader";
1110
import { calculateAmount } from "services/teams";
@@ -14,7 +13,7 @@ import theme from "./theme";
1413
import FallbackIcon from "../../../../assets/images/icon-role-fallback.svg";
1514
import "./styles.module.scss";
1615

17-
const stripePromise = loadStripe(config.STRIPE_PUBLIC_KEY);
16+
const stripePromise = loadStripe(process.env.STRIPE_PUBLIC_KEY);
1817

1918
const CreateTassPayment = () => {
2019
const [calculatedAmount, setCalculatedAmount] = useState(0);
@@ -37,9 +36,11 @@ const CreateTassPayment = () => {
3736
} = role;
3837
let rate;
3938

40-
if (hoursPerWeek === "30") rate = rates.rate30Global;
41-
else if (hoursPerWeek === "20") rate = rates.rate20Global;
42-
else if (hoursPerWeek === "40") rate = rates.global;
39+
if (hoursPerWeek) {
40+
if (hoursPerWeek === "30") rate = rates.rate30Global;
41+
else if (hoursPerWeek === "20") rate = rates.rate20Global;
42+
else if (hoursPerWeek === "40") rate = rates.global;
43+
} else rate = rates.global;
4344

4445
temp.push({
4546
imageUrl,

0 commit comments

Comments
 (0)