Compare commits
2 Commits
v1.3.60
...
v1.3.62-fix
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a4ccabd1b | |||
| 32728eec37 |
@@ -256,6 +256,9 @@ impl SupabaseClient {
|
|||||||
urlencoding::encode(id_fechamento)
|
urlencoding::encode(id_fechamento)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Log do que está sendo enviado (debug)
|
||||||
|
log::info!("[PATCH] url={} body={}", url, updates);
|
||||||
|
|
||||||
let resp = self
|
let resp = self
|
||||||
.http
|
.http
|
||||||
.patch(&url)
|
.patch(&url)
|
||||||
@@ -264,11 +267,18 @@ impl SupabaseClient {
|
|||||||
.json(updates)
|
.json(updates)
|
||||||
.send()?;
|
.send()?;
|
||||||
|
|
||||||
if resp.status().is_success() {
|
let status = resp.status();
|
||||||
|
if status.is_success() {
|
||||||
|
// Ler a resposta real do Supabase (retorna o registro atualizado)
|
||||||
|
if let Ok(ret) = resp.json::<serde_json::Value>() {
|
||||||
|
log::info!("[PATCH] sucesso — resposta: {}", ret);
|
||||||
|
} else {
|
||||||
|
log::warn!("[PATCH] sucesso mas não conseguiu ler resposta");
|
||||||
|
}
|
||||||
Ok(serde_json::json!({ "ok": true, "id_fechamento": id_fechamento }))
|
Ok(serde_json::json!({ "ok": true, "id_fechamento": id_fechamento }))
|
||||||
} else {
|
} else {
|
||||||
let status = resp.status();
|
|
||||||
let body = resp.text().unwrap_or_default();
|
let body = resp.text().unwrap_or_default();
|
||||||
|
log::error!("[PATCH] HTTP {} body: {}", status.as_u16(), body);
|
||||||
Err(SupabaseError::Api(format!(
|
Err(SupabaseError::Api(format!(
|
||||||
"HTTP {}: {}",
|
"HTTP {}: {}",
|
||||||
status.as_u16(),
|
status.as_u16(),
|
||||||
@@ -504,7 +514,7 @@ pub fn sb_buscar_por_id_fechamento(
|
|||||||
sb.buscar_por_id_fechamento(&id_fechamento)
|
sb.buscar_por_id_fechamento(&id_fechamento)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
pub fn sb_atualizar_fechamento(
|
pub fn sb_atualizar_fechamento(
|
||||||
sb: State<'_, SupabaseClient>,
|
sb: State<'_, SupabaseClient>,
|
||||||
id_fechamento: String,
|
id_fechamento: String,
|
||||||
|
|||||||
Reference in New Issue
Block a user