fix: save profile when update
This commit is contained in:
parent
aed1bdff5a
commit
4942b0fca5
@ -76,7 +76,7 @@ pub fn select_profile(index: String, core: State<'_, Core>) -> CmdResult {
|
|||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn change_profile_chain(chain: Option<Vec<String>>, core: State<'_, Core>) -> CmdResult {
|
pub fn change_profile_chain(chain: Option<Vec<String>>, core: State<'_, Core>) -> CmdResult {
|
||||||
let mut profiles = core.profiles.lock();
|
let mut profiles = core.profiles.lock();
|
||||||
profiles.put_chain(chain);
|
wrap_err!(profiles.put_chain(chain))?;
|
||||||
|
|
||||||
drop(profiles);
|
drop(profiles);
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ pub fn change_profile_chain(chain: Option<Vec<String>>, core: State<'_, Core>) -
|
|||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn change_profile_valid(valid: Option<Vec<String>>, core: State<Core>) -> CmdResult {
|
pub fn change_profile_valid(valid: Option<Vec<String>>, core: State<Core>) -> CmdResult {
|
||||||
let mut profiles = core.profiles.lock();
|
let mut profiles = core.profiles.lock();
|
||||||
profiles.put_valid(valid);
|
wrap_err!(profiles.put_valid(valid))?;
|
||||||
|
|
||||||
drop(profiles);
|
drop(profiles);
|
||||||
|
|
||||||
|
@ -91,13 +91,15 @@ impl Profiles {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// just change the `chain`
|
/// just change the `chain`
|
||||||
pub fn put_chain(&mut self, chain: Option<Vec<String>>) {
|
pub fn put_chain(&mut self, chain: Option<Vec<String>>) -> Result<()> {
|
||||||
self.chain = chain;
|
self.chain = chain;
|
||||||
|
self.save_file()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// just change the `field`
|
/// just change the `field`
|
||||||
pub fn put_valid(&mut self, valid: Option<Vec<String>>) {
|
pub fn put_valid(&mut self, valid: Option<Vec<String>>) -> Result<()> {
|
||||||
self.valid = valid;
|
self.valid = valid;
|
||||||
|
self.save_file()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// get items ref
|
/// get items ref
|
||||||
|
Loading…
Reference in New Issue
Block a user