MCPcopy Create free account
hub / github.com/acking-you/static_flow / admin_delete_comment_task

Function admin_delete_comment_task

crates/frontend/src/api.rs:4255–4284  ·  view source on GitHub ↗
(
    task_id: &str,
    request: &AdminTaskActionRequest,
)

Source from the content-addressed store, hash-verified

4253}
4254
4255pub async fn admin_delete_comment_task(
4256 task_id: &str,
4257 request: &AdminTaskActionRequest,
4258) -> Result<serde_json::Value, String> {
4259 #[cfg(feature = "mock")]
4260 {
4261 let _ = request;
4262 Ok(serde_json::json!({ "task_id": task_id, "deleted": true }))
4263 }
4264
4265 #[cfg(not(feature = "mock"))]
4266 {
4267 let url =
4268 format!("{}/admin/comments/tasks/{}", admin_base(), urlencoding::encode(task_id),);
4269 let response = api_delete(&url)
4270 .header("Content-Type", "application/json")
4271 .json(request)
4272 .map_err(|e| format!("Serialize error: {:?}", e))?
4273 .send()
4274 .await
4275 .map_err(|e| format!("Network error: {:?}", e))?;
4276 if !response.ok() {
4277 return Err(format!("HTTP error: {}", response.status()));
4278 }
4279 response
4280 .json()
4281 .await
4282 .map_err(|e| format!("Parse error: {:?}", e))
4283 }
4284}
4285
4286pub async fn fetch_admin_published_comments(
4287 article_id: Option<&str>,

Callers 1

admin_pageFunction · 0.50

Calls 2

api_deleteFunction · 0.85
okMethod · 0.80

Tested by

no test coverage detected