fix(rust): add serde camelCase rename to IPC structs
Rust structs use snake_case by default, but TypeScript expects camelCase. Without rename_all, profile.dashboardConfig was undefined because the JSON field was dashboard_config. This caused 'undefined is not an object' when accessing profile.dashboardConfig.widgets.
This commit is contained in:
parent
807c12e820
commit
f42cad608c
1 changed files with 5 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ use synq_security::PhiClassifier;
|
|||
use tauri::{AppHandle, Manager};
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct StreamMessage {
|
||||
pub id: String,
|
||||
pub role: String,
|
||||
|
|
@ -18,6 +19,7 @@ pub struct StreamMessage {
|
|||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SystemStatus {
|
||||
pub backend: String,
|
||||
pub data_class: String,
|
||||
|
|
@ -25,6 +27,7 @@ pub struct SystemStatus {
|
|||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct DashboardWidget {
|
||||
pub id: String,
|
||||
pub r#type: String,
|
||||
|
|
@ -35,6 +38,7 @@ pub struct DashboardWidget {
|
|||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct DashboardConfig {
|
||||
pub widgets: Vec<DashboardWidget>,
|
||||
pub visible_channels: Vec<String>,
|
||||
|
|
@ -43,6 +47,7 @@ pub struct DashboardConfig {
|
|||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct UserProfile {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
|
|
|
|||
Loading…
Reference in a new issue