You've already forked AstralRinth
forked from didirus/AstralRinth
added settings API + fixed bug (#62)
* added settings API + fixed bug * removed redundant API funcs * comment clarifications --------- Co-authored-by: Wyatt <wyatt@modrinth.com>
This commit is contained in:
@@ -6,6 +6,7 @@ pub mod auth;
|
||||
|
||||
pub mod profile;
|
||||
pub mod profile_create;
|
||||
pub mod settings;
|
||||
|
||||
pub type Result<T> = std::result::Result<T, TheseusGuiError>;
|
||||
|
||||
|
||||
17
theseus_gui/src-tauri/src/api/settings.rs
Normal file
17
theseus_gui/src-tauri/src/api/settings.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use crate::api::Result;
|
||||
use theseus::prelude::*;
|
||||
|
||||
// Get full settings
|
||||
// invoke('settings_get')
|
||||
#[tauri::command]
|
||||
pub async fn settings_get() -> Result<Settings> {
|
||||
Ok(settings::get().await?)
|
||||
}
|
||||
|
||||
// Set full settings
|
||||
// invoke('settings_set', settings)
|
||||
#[tauri::command]
|
||||
pub async fn settings_set(settings: Settings) -> Result<()> {
|
||||
settings::set(settings).await?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -38,6 +38,8 @@ fn main() {
|
||||
api::auth::auth_has_user,
|
||||
api::auth::auth_users,
|
||||
api::auth::auth_get_user,
|
||||
api::settings::settings_get,
|
||||
api::settings::settings_set,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
|
||||
Reference in New Issue
Block a user