feat: restructure project, implement askama templating #26

Merged
theo merged 21 commits from restructure-project into main 2024-07-26 14:42:03 +02:00
Showing only changes of commit f8d7f82c50 - Show all commits

View File

@ -1,4 +1,3 @@
use core::panic;
use std::sync::Arc; use std::sync::Arc;
use tauri::{path::BaseDirectory, Manager}; use tauri::{path::BaseDirectory, Manager};
@ -24,23 +23,18 @@ async fn process_tauri_request(
let request = AxumRequest::from_parts(parts, body); let request = AxumRequest::from_parts(parts, body);
// Process the request with the router // Process the request with the router
let response = match router.as_service().ready().await { let response = router
Ok(ready_service) => ready_service.call(request).await, .as_service()
Err(_error) => panic!("Failed to get ready service"), .ready().await
}; .expect("Failed to get ready service")
.call(request).await
let response = match response { .expect("Failed to get response from router");
Ok(response) => response,
Err(_error) => panic!("Problem getting response from request."),
};
// Convert the Axum response to a Tauri response // Convert the Axum response to a Tauri response
let (parts, body) = response.into_parts(); let (parts, body) = response.into_parts();
let body = to_bytes(body, usize::MAX).await { let body = to_bytes(body, usize::MAX).await
Ok(bytes) => bytes.to_vec(), .expect("Failed to convert body to bytes")
Err(_error) => panic!("Problem converting response body to bytes."), .to_vec();
};
let response = TauriResponse::from_parts(parts, body); let response = TauriResponse::from_parts(parts, body);
response response