From 8890051c1709813a0cdff45ee20daae7e760bebc Mon Sep 17 00:00:00 2001
From: GyDi <segydi@foxmail.com>
Date: Fri, 11 Mar 2022 19:56:56 +0800
Subject: [PATCH] fix: patch item option

---
 src/components/profile/profile-edit.tsx | 2 +-
 src/components/profile/profile-new.tsx  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/components/profile/profile-edit.tsx b/src/components/profile/profile-edit.tsx
index a739ebb..871d69a 100644
--- a/src/components/profile/profile-edit.tsx
+++ b/src/components/profile/profile-edit.tsx
@@ -41,7 +41,7 @@ const ProfileEdit = (props: Props) => {
     try {
       const { uid } = itemData;
       const { name, desc, url } = form;
-      const option_ = showOpt ? option : undefined;
+      const option_ = itemData.type === "remote" ? option : undefined;
 
       if (itemData.type === "remote" && !url) {
         throw new Error("Remote URL should not be null");
diff --git a/src/components/profile/profile-new.tsx b/src/components/profile/profile-new.tsx
index efebd5f..a52913c 100644
--- a/src/components/profile/profile-new.tsx
+++ b/src/components/profile/profile-new.tsx
@@ -54,7 +54,7 @@ const ProfileNew = (props: Props) => {
         throw new Error("The URL should not be null");
       }
 
-      const option_ = showOpt ? option : undefined;
+      const option_ = form.type === "remote" ? option : undefined;
       await createProfile({ ...form, name, option: option_ });
       setForm({ type: "remote", name: "", desc: "", url: "" });
       setOption({ user_agent: "" });
-- 
GitLab