refactor: linkify

This commit is contained in:
Tristan Yang
2023-01-20 09:31:33 +08:00
parent 37f916f7c3
commit 5171ca5e8e
9 changed files with 521 additions and 390 deletions
@@ -1,5 +1,6 @@
import { ChangeEvent, FC, useState } from "react";
import toast from "react-hot-toast";
import * as linkify from 'linkifyjs';
import Modal from "../../../common/component/Modal";
import StyledModal from "../../../common/component/styled/Modal";
import Button from "../../../common/component/styled/Button";
@@ -49,6 +50,10 @@ const LicensePriceListModal: FC<Props> = ({ closeModal }) => {
`${LicensePriceList[0].pid}|${LicensePriceList[0].limit}|${LicensePriceList[0].type}|${LicensePriceList[0].sub_dur || ""}`
);
const handleRenew = async () => {
if (!linkify.test(host)) {
toast.error("Invalid Host");
return;
}
const [priceId, user_limit, type, sub_dur = "month"] = selectPrice.split("|") as [string, string, PriceType, PriceSubscriptionDuration];
const metadata = {
user_limit: Number(user_limit),