mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-27 06:40:02 +00:00
fix tencent cos input verify
This commit is contained in:
parent
195aa54cdc
commit
59584a2961
@ -46,6 +46,21 @@ const DeployToTencentCOS = () => {
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const regionResp = regionSchema.safeParse(data.config?.bucket);
|
||||||
|
if (!regionResp.success) {
|
||||||
|
setError({
|
||||||
|
...error,
|
||||||
|
region: JSON.parse(regionResp.error.message)[0].message,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setError({
|
||||||
|
...error,
|
||||||
|
region: "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!data.id) {
|
if (!data.id) {
|
||||||
setDeploy({
|
setDeploy({
|
||||||
@ -63,10 +78,14 @@ const DeployToTencentCOS = () => {
|
|||||||
message: t("common.errmsg.domain_invalid"),
|
message: t("common.errmsg.domain_invalid"),
|
||||||
});
|
});
|
||||||
|
|
||||||
const bucketSchema = z.string().min(1, {
|
const regionSchema = z.string().regex(/^ap-[a-z]+$/, {
|
||||||
message: t("domain.deployment.form.cos_region.placeholder"),
|
message: t("domain.deployment.form.cos_region.placeholder"),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const bucketSchema = z.string().regex(/^.+-\d+$/, {
|
||||||
|
message: t("domain.deployment.form.cos_bucket.placeholder"),
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col space-y-8">
|
<div className="flex flex-col space-y-8">
|
||||||
<div>
|
<div>
|
||||||
@ -78,6 +97,19 @@ const DeployToTencentCOS = () => {
|
|||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const temp = e.target.value;
|
const temp = e.target.value;
|
||||||
|
|
||||||
|
const resp = bucketSchema.safeParse(temp);
|
||||||
|
if (!resp.success) {
|
||||||
|
setError({
|
||||||
|
...error,
|
||||||
|
region: JSON.parse(resp.error.message)[0].message,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setError({
|
||||||
|
...error,
|
||||||
|
region: "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const newData = produce(data, (draft) => {
|
const newData = produce(data, (draft) => {
|
||||||
if (!draft.config) {
|
if (!draft.config) {
|
||||||
draft.config = {};
|
draft.config = {};
|
||||||
@ -87,7 +119,7 @@ const DeployToTencentCOS = () => {
|
|||||||
setDeploy(newData);
|
setDeploy(newData);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<div className="text-red-600 text-sm mt-1">{error?.endpoint}</div>
|
<div className="text-red-600 text-sm mt-1">{error?.region}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user