fix: profile field check

This commit is contained in:
GyDi
2022-03-07 01:30:32 +08:00
parent 8ea3e6fa26
commit 743788135f
2 changed files with 12 additions and 1 deletions

View File

@@ -40,7 +40,13 @@ const ProfileNew = (props: Props) => {
}
try {
await createProfile({ ...form });
const name = form.name || `${form.type} file`;
if (form.type === "remote" && !form.url) {
throw new Error("Remote URL should not be null");
}
await createProfile({ ...form, name });
setForm({ name: "", desc: "", type: "remote", url: "" });
mutate("getProfiles");
onClose();