fix: result

This commit is contained in:
GyDi committed 2022-03-03 01:56:47 +08:00
1 parent 1d65287fbb
commit 8ff22bc737
2 files changed
+6 -6

No files matched your search

+3 -3
View File
@@ -301,6 +301,9 @@ impl Clash {
let info = self.info.clone(); let info = self.info.clone();
let mut config = self.config.clone(); let mut config = self.config.clone();
// generate the payload
let payload = profiles.gen_enhanced()?;
win.once(&event_name, move |event| { win.once(&event_name, move |event| {
if let Some(result) = event.payload() { if let Some(result) = event.payload() {
let gen_map: Mapping = serde_json::from_str(result).unwrap(); let gen_map: Mapping = serde_json::from_str(result).unwrap();
@@ -312,9 +315,6 @@ impl Clash {
} }
}); });
// generate the payload
let payload = profiles.gen_enhanced();
tauri::async_runtime::spawn(async move { tauri::async_runtime::spawn(async move {
sleep(Duration::from_secs(5)).await; sleep(Duration::from_secs(5)).await;
win.emit("script-handler", payload).unwrap(); win.emit("script-handler", payload).unwrap();
+3 -3
View File
@@ -438,8 +438,8 @@ impl Profiles {
} }
/// gen the enhanced profiles /// gen the enhanced profiles
pub fn gen_enhanced(&self) -> PrfEnhanced { pub fn gen_enhanced(&self) -> Result<PrfEnhanced> {
let current = self.gen_activate().unwrap(); let current = self.gen_activate()?;
let chain = match self.chain.as_ref() { let chain = match self.chain.as_ref() {
Some(chain) => chain Some(chain) => chain
@@ -454,7 +454,7 @@ impl Profiles {
None => vec![], None => vec![],
}; };
PrfEnhanced { current, chain } Ok(PrfEnhanced { current, chain })
} }
} }