Files
spacedrive/core/src/api/web_api.rs
Ericson "Fogo" Soares bfe5a65949 [ENG-1267] Move thumbnails generation away from media processor (#1585)
* New vscode task to start developing

* Updating db in case of library updates just in case

* Done

* Forgot to remove some debug logs

* Rust fmt

* Saving thumbnails processing state on app shutdown

* bruh
2023-10-17 02:09:36 +00:00

41 lines
760 B
Rust

use rspc::alpha::AlphaRouter;
use serde::{Deserialize, Serialize};
use specta::Type;
use crate::util::http::ensure_response;
use super::{Ctx, R};
pub(crate) fn mount() -> AlphaRouter<Ctx> {
R.router().procedure(
"sendFeedback",
R.mutation({
#[derive(Debug, Type, Serialize, Deserialize)]
struct Feedback {
message: String,
emoji: u8,
}
|node, args: Feedback| async move {
node.add_auth_header(
node.http
.post(&format!("{}/api/v1/feedback", &node.env.api_url)),
)
.await
.json(&args)
.send()
.await
.map_err(|_| {
rspc::Error::new(
rspc::ErrorCode::InternalServerError,
"Request failed".to_string(),
)
})
.and_then(ensure_response)?;
Ok(())
}
}),
)
}