(
config: &CommentRuntimeConfig,
)
| 4039 | } |
| 4040 | |
| 4041 | pub async fn update_admin_comment_runtime_config( |
| 4042 | config: &CommentRuntimeConfig, |
| 4043 | ) -> Result<CommentRuntimeConfig, String> { |
| 4044 | #[cfg(feature = "mock")] |
| 4045 | { |
| 4046 | Ok(config.clone()) |
| 4047 | } |
| 4048 | |
| 4049 | #[cfg(not(feature = "mock"))] |
| 4050 | { |
| 4051 | let url = format!("{}/admin/comment-config", admin_base()); |
| 4052 | let response = api_post(&url) |
| 4053 | .header("Content-Type", "application/json") |
| 4054 | .json(config) |
| 4055 | .map_err(|e| format!("Serialize error: {:?}", e))? |
| 4056 | .send() |
| 4057 | .await |
| 4058 | .map_err(|e| format!("Network error: {:?}", e))?; |
| 4059 | if !response.ok() { |
| 4060 | return Err(format!("HTTP error: {}", response.status())); |
| 4061 | } |
| 4062 | response |
| 4063 | .json() |
| 4064 | .await |
| 4065 | .map_err(|e| format!("Parse error: {:?}", e)) |
| 4066 | } |
| 4067 | } |
| 4068 | |
| 4069 | pub async fn fetch_admin_comment_tasks_grouped( |
| 4070 | status: Option<&str>, |
no test coverage detected