fix: update license error tip

This commit is contained in:
Tristan Yang
2023-01-29 08:13:53 +08:00
parent 72f57b6ff1
commit 23b452f579
4 changed files with 9 additions and 15 deletions
@@ -8,7 +8,7 @@ import Textarea from "../../../common/component/styled/Textarea";
import { useTranslation } from "react-i18next";
interface Props {
closeModal: () => void;
updateLicense: (param: string) => void;
updateLicense: (param: string) => Promise<any>;
updated: boolean;
updating: boolean
// domain: string;
@@ -19,9 +19,11 @@ const UpdateLicenseModal: FC<Props> = ({ closeModal, updateLicense, updating, up
const { t } = useTranslation("setting");
const { t: ct } = useTranslation();
const handleRenew = () => {
updateLicense(value);
const handleRenew = async () => {
const updateSuccess = await updateLicense(value);
if (typeof updateSuccess == "boolean" && !updateSuccess) {
toast.error("Check License Invalid!");
}
};
const handleLicenseUpdate = (evt: ChangeEvent<HTMLTextAreaElement>) => {
setValue(evt.target.value);
+2 -2
View File
@@ -6,7 +6,7 @@ import LicensePriceListModal from "./LicensePriceListModal";
import clsx from "clsx";
import { useTranslation } from "react-i18next";
import UpdateLicenseModal from "./UpdateLicenseModal";
import Tippy from "@tippyjs/react";
// import Tippy from "@tippyjs/react";
interface ItemProps extends HTMLAttributes<HTMLSpanElement> { label: string, data?: string | number | string[], foldable?: boolean }
const Item = ({ label, data, foldable = false, ...rest }: ItemProps) => {
@@ -26,7 +26,7 @@ const Item = ({ label, data, foldable = false, ...rest }: ItemProps) => {
};
export default function License() {
const { t, i18n } = useTranslation("setting");
const { t: ct } = useTranslation();
// const { t: ct } = useTranslation();
const { license: licenseInfo, reachLimit, upsertLicense, upserting, upserted } = useLicense();
const [modalVisible, setModalVisible] = useState(false);
const [updateVisible, setUpdateVisible] = useState(false);