mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-07-25 17:24:48 +10:00
fix(settings): Broken command invoke logic in settings/downloads.vue
This commit is contained in:
@@ -90,7 +90,6 @@
|
|||||||
<div class="mt-6">
|
<div class="mt-6">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
:disabled="!downloadThreadsChanged"
|
|
||||||
@click="saveDownloadThreads"
|
@click="saveDownloadThreads"
|
||||||
class="inline-flex items-center rounded-md bg-blue-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 disabled:bg-blue-600/50 disabled:cursor-not-allowed"
|
class="inline-flex items-center rounded-md bg-blue-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 disabled:bg-blue-600/50 disabled:cursor-not-allowed"
|
||||||
>
|
>
|
||||||
@@ -280,6 +279,6 @@ async function deleteDirectory(index: number) {
|
|||||||
|
|
||||||
async function saveDownloadThreads() {
|
async function saveDownloadThreads() {
|
||||||
//Would save download threads downloadThreads.value);
|
//Would save download threads downloadThreads.value);
|
||||||
await invoke("amend_settings", { newSettings: { max_download_threads: downloadThreads.value } })
|
await invoke("update_settings", { newSettings: { maxDownloadThreads: downloadThreads.value } })
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -59,13 +59,11 @@ pub fn add_download_dir(new_dir: PathBuf) -> UserValue<(), Error> {
|
|||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn update_settings(new_settings: Value) {
|
pub fn update_settings(new_settings: Value) {
|
||||||
println!("{}", new_settings);
|
|
||||||
let mut db_lock = DB.borrow_data_mut().unwrap();
|
let mut db_lock = DB.borrow_data_mut().unwrap();
|
||||||
let mut current_settings = serde_json::to_value(db_lock.settings.clone()).unwrap();
|
let mut current_settings = serde_json::to_value(db_lock.settings.clone()).unwrap();
|
||||||
for (key, value) in new_settings.as_object().unwrap() {
|
for (key, value) in new_settings.as_object().unwrap() {
|
||||||
current_settings[key] = value.clone();
|
current_settings[key] = value.clone();
|
||||||
}
|
}
|
||||||
println!("New settings unset: {}", ¤t_settings);
|
|
||||||
let new_settings: Settings = serde_json::from_value(current_settings).unwrap();
|
let new_settings: Settings = serde_json::from_value(current_settings).unwrap();
|
||||||
db_lock.settings = new_settings;
|
db_lock.settings = new_settings;
|
||||||
println!("New Settings: {:?}", db_lock.settings);
|
println!("New Settings: {:?}", db_lock.settings);
|
||||||
|
|||||||
Reference in New Issue
Block a user