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