Fix PR 3 review findings [skip ci]

This commit is contained in:
SCOPEDD committed 2026-09-29 23:21:14 -04:00
1 parent 590178e41a
commit 454620f21e
21 files changed
+522 -160

No files matched your search

+7 -3
View File
@@ -607,6 +607,8 @@ pub async fn create_guild(
name: String,
tag: String,
description: String,
icon_url: Option<String>,
banner_url: Option<String>,
) -> Res<Guild> {
let req = account_api(&state, reqwest::Method::POST, "/guilds").await?;
let resp = req.json(&serde_json::json!({
@@ -614,6 +616,8 @@ pub async fn create_guild(
"name": name,
"tag": tag,
"description": description,
"icon_url": icon_url,
"banner_url": banner_url,
})).send().await.map_err(err)?;
if !resp.status().is_success() {
let body: serde_json::Value = resp.json().await.unwrap_or_default();
@@ -950,12 +954,12 @@ pub async fn create_user_post(
}
#[tauri::command]
pub async fn like_user_post(state: State<'_, AppState>, post_id: i64) -> Res<()> {
pub async fn like_user_post(state: State<'_, AppState>, post_id: i64) -> Res<bool> {
let req = account_api(&state, reqwest::Method::POST, &format!("/posts/{post_id}/like")).await?;
let resp = req.send().await.map_err(err)?;
if !resp.status().is_success() {
return Err("unable to like post".into());
}
Ok(())
let body: serde_json::Value = resp.json().await.map_err(err)?;
Ok(body["liked"].as_bool().unwrap_or(false))
}