Bläddra i källkod

fix: profile updated field

GyDi 3 år sedan
förälder
incheckning
e9b7ec735f

+ 1 - 2
src-tauri/src/core/profiles.rs

@@ -380,8 +380,7 @@ impl Profiles {
         patch!(each, item, url);
         patch!(each, item, selected);
         patch!(each, item, extra);
-
-        each.updated = Some(help::get_now());
+        patch!(each, item, updated);
 
         self.items = Some(items);
         return self.save_file();

+ 1 - 1
src/components/proxy/proxy-group.tsx

@@ -75,7 +75,7 @@ const ProxyGroup = ({ group }: Props) => {
       } else {
         profile.selected[index] = { name: group.name, now: name };
       }
-      await patchProfile(profiles!.current!, profile);
+      await patchProfile(profiles!.current!, { selected: profile.selected });
     } catch (err) {
       console.error(err);
     }

+ 4 - 1
src/pages/profiles.tsx

@@ -81,7 +81,10 @@ const ProfilePage = () => {
         name,
         now,
       }));
-      patchProfile(current!, profile).catch(console.error);
+
+      patchProfile(current!, { selected: profile.selected }).catch(
+        console.error
+      );
       // update proxies cache
       if (hasChange) mutate("getProxies", getProxies());
     }, 100);

+ 1 - 1
src/services/cmds.ts

@@ -35,7 +35,7 @@ export async function deleteProfile(index: string) {
 
 export async function patchProfile(
   index: string,
-  profile: CmdType.ProfileItem
+  profile: Partial<CmdType.ProfileItem>
 ) {
   return invoke<void>("patch_profile", { index, profile });
 }