Skip to content
Snippets Groups Projects
Unverified Commit 74378813 authored by GyDi's avatar GyDi
Browse files

fix: profile field check

parent 8ea3e6fa
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,11 @@ const ProfileEdit = (props: Props) => {
try {
const { uid } = itemData;
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 });
mutate("getProfiles");
onClose();
......
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment