Skip to content

Commit

Permalink
Closes #11 (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrenekH authored Oct 12, 2024
1 parent 8457f24 commit 30beef6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src-tauri/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ pub static DEFAULT_CONFIG: &'static str = indoc! {r#"
"db_name": "",
"db_url": "",
"db_token": "",
"theme": "dark"
"theme": "dark",
"book_lists": ["In Progress", "Planned", "Aside", "Completed", "Dropped"]
}
"#};

Expand All @@ -43,6 +44,7 @@ pub struct Config {
pub db_url: String,
pub db_token: String,
pub theme: String,
pub book_lists: Vec<String>,
}

impl Config {
Expand Down Expand Up @@ -78,6 +80,13 @@ impl Config {
db_url: "".into(),
db_token: "".into(),
theme: "dark".into(),
book_lists: vec![
"In Progress".into(),
"Planned".into(),
"Aside".into(),
"Completed".into(),
"Dropped".into(),
],
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,15 @@ fn update_config(
db_url: String,
db_token: String,
theme: String,
book_lists: Vec<String>,
) -> Result<String> {
match config::write_config(Config {
username,
db_name,
db_url,
db_token,
theme,
book_lists,
}) {
Ok(_) => Ok(String::from("Wrote new config successfully!")),
Err(e) => Err(Error { msg: e }),
Expand Down

0 comments on commit 30beef6

Please sign in to comment.