mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-28 12:21:47 +01:00
Got Codemirror up and running
This commit is contained in:
@@ -9,9 +9,23 @@ fn greet(name: &str) -> String {
|
||||
format!("Hello, {}! You've been greeted from Rust!", name)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn send_request(url: &str) -> Result<String, String> {
|
||||
let mut url = url.to_string();
|
||||
if !url.starts_with("http://") && !url.starts_with("https://") {
|
||||
url = format!("http://{}", url);
|
||||
}
|
||||
|
||||
let resp = reqwest::get(url).await;
|
||||
match resp {
|
||||
Ok(v) => Ok(v.text().await.unwrap()),
|
||||
Err(e) => Err(e.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![greet])
|
||||
.invoke_handler(tauri::generate_handler![send_request, greet])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user