fix: profile field check
This commit is contained in:
parent
8ea3e6fa26
commit
743788135f
@ -34,6 +34,11 @@ const ProfileEdit = (props: Props) => {
|
|||||||
try {
|
try {
|
||||||
const { uid } = itemData;
|
const { uid } = itemData;
|
||||||
const { name, desc, url } = form;
|
const { name, desc, url } = form;
|
||||||
|
|
||||||
|
if (itemData.type === "remote" && !url) {
|
||||||
|
throw new Error("Remote URL should not be null");
|
||||||
|
}
|
||||||
|
|
||||||
await patchProfile(uid, { uid, name, desc, url });
|
await patchProfile(uid, { uid, name, desc, url });
|
||||||
mutate("getProfiles");
|
mutate("getProfiles");
|
||||||
onClose();
|
onClose();
|
||||||
|
@ -40,7 +40,13 @@ const ProfileNew = (props: Props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
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: "" });
|
setForm({ name: "", desc: "", type: "remote", url: "" });
|
||||||
mutate("getProfiles");
|
mutate("getProfiles");
|
||||||
onClose();
|
onClose();
|
||||||
|
Loading…
Reference in New Issue
Block a user