mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-22 15:40:07 -04:00
* 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
41 lines
760 B
Rust
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(())
|
|
}
|
|
}),
|
|
)
|
|
}
|