🐛 Removing ts pattern

This commit is contained in:
Maxime Lalo 2024-04-17 13:27:27 +02:00
parent de1c5aaf8e
commit f933b58ee5
2 changed files with 7 additions and 11 deletions

View File

@ -34,7 +34,6 @@
"react-toastify": "^9.1.3",
"sass": "^1.59.2",
"sharp": "^0.32.1",
"ts-pattern": "^4.3.0",
"typescript": "4.9.5",
"uuidv4": "^6.2.13"
}

View File

@ -8,7 +8,6 @@ import classnames from "classnames";
import { EType } from "le-coffre-resources/dist/Admin/Subscription";
import Stripe from "@Front/Api/LeCoffreApi/Admin/Stripe/Stripe";
import { useRouter } from "next/router";
import * as P from "ts-pattern";
type IProps = {
forfeitType: EForfeitType;
@ -37,15 +36,13 @@ export default function SubscribeCheckoutTicket(props: IProps) {
useEffect(() => {
let multiplierToUse = paymentFrequency === EPaymentFrequency.yearly ? multiplier - 1 : multiplier;
P.match(forfeitType)
.with(EForfeitType.standard, () => {
setTotalPlan(forfeitsPrices[EForfeitType.standard] * multiplierToUse);
setTotalCollaborator(collaboratorPrice * numberOfCollaborators * multiplier);
})
.with(EForfeitType.unlimited, () => {
if (forfeitType === EForfeitType.unlimited) {
setTotalPlan(forfeitsPrices[EForfeitType.unlimited] * multiplierToUse);
setTotalCollaborator(0);
});
} else {
setTotalPlan(forfeitsPrices[EForfeitType.standard] * multiplierToUse);
setTotalCollaborator(collaboratorPrice * numberOfCollaborators * multiplier);
}
}, [multiplier, forfeitType, numberOfCollaborators, paymentFrequency]);
const handleFrequencyChange = (e: React.ChangeEvent<HTMLInputElement>) => {