diff --git a/.gitignore b/.gitignore index a547bf3..0bf99b2 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ dist-ssr *.njsproj *.sln *.sw? +options.json diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index 2b607dd..5e9aae8 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -11,11 +11,17 @@ pub fn check_auth(state: State) -> bool { } else { let client = Client::new(); let response = client - .get("https://osma-server.herokuapp.com/personal_library") + .get("https://osma-server.herokuapp.com/api/personal_library") .bearer_auth(&state.jwt) .send(); match response { - Ok(_) => true, + Ok(response) => { + if response.status().is_success() { + true + } else { + false + } + } Err(_) => false, } } diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index f982343..2e3ae48 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -10,7 +10,7 @@ use types::*; mod commands; fn main() { - let options = fs::read_to_string("./options.json").unwrap_or("{\"jwt\":null}".to_string()); + let options = fs::read_to_string("options.json").unwrap_or("{\"jwt\":null}".to_string()); tauri::Builder::default() .manage( serde_json::from_str::(&options).unwrap_or(AppData {