Skip to content

Commit 82aba20

Browse files
refactor: remove unnecessary code from add user
1 parent 12f60c9 commit 82aba20

File tree

1 file changed

+4
-28
lines changed

1 file changed

+4
-28
lines changed

apps/OpenSign/src/components/AddUser.js

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,10 @@ const AddUser = (props) => {
2727
password: "",
2828
role: ""
2929
});
30-
const [amount, setAmount] = useState({
31-
quantity: 1,
32-
price: 0,
33-
totalPrice: 0
34-
});
30+
const [amount, setAmount] = useState({ quantity: 1, price: 0 });
3531
const [planInfo, setPlanInfo] = useState({
3632
priceperUser: 0,
3733
price: 0,
38-
totalPrice: 0,
3934
totalAllowedUser: 0
4035
});
4136
const [isFormLoader, setIsFormLoader] = useState(false);
@@ -59,14 +54,9 @@ const AddUser = (props) => {
5954
setPlanInfo((prev) => ({
6055
...prev,
6156
priceperUser: resSub.price,
62-
totalPrice: resSub.totalPrice,
6357
totalAllowedUser: resSub.totalAllowedUser
6458
}));
65-
setAmount((prev) => ({
66-
...prev,
67-
price: resSub.price,
68-
totalPrice: resSub.price + resSub.totalPrice
69-
}));
59+
setAmount((prev) => ({ ...prev, price: resSub.price }));
7060
const res = await Parse.Cloud.run("allowedusers");
7161
if (props.setFormHeader) {
7262
if (res > 0) {
@@ -287,13 +277,7 @@ const AddUser = (props) => {
287277
const handlePricePerUser = (e) => {
288278
const quantity = e.target.value;
289279
const price = e.target?.value > 0 ? planInfo.priceperUser * quantity : 0;
290-
const totalprice = price + planInfo.totalPrice;
291-
setAmount((prev) => ({
292-
...prev,
293-
quantity: quantity,
294-
price: price,
295-
totalPrice: totalprice
296-
}));
280+
setAmount((prev) => ({ ...prev, quantity: quantity, price: price }));
297281
};
298282
const handleAddOnSubmit = async (e) => {
299283
e.preventDefault();
@@ -529,15 +513,7 @@ const AddUser = (props) => {
529513
</div>
530514
</div>
531515
<hr className="text-base-content mb-3" />
532-
<div className=" flex justify-between">
533-
<label className="block text-sm text-gray-700 font-semibold">
534-
{t("Total-price-for-next-time")}
535-
</label>
536-
<div className="w-1/4 flex justify-center items-center text-sm font-semibold">
537-
USD {amount.totalPrice}
538-
</div>
539-
</div>
540-
<button className="op-btn op-btn-primary w-full mt-2">
516+
<button className="op-btn op-btn-primary w-full">
541517
{t("Proceed")}
542518
</button>
543519
</form>

0 commit comments

Comments
 (0)