refactor(state): drop kon_tasks localStorage cache — Tauri-first, UI-on-success
This commit is contained in:
@@ -67,7 +67,7 @@ pub struct CreateTaskRequest {
|
||||
pub async fn create_task_cmd(
|
||||
state: tauri::State<'_, AppState>,
|
||||
request: CreateTaskRequest,
|
||||
) -> Result<(), String> {
|
||||
) -> Result<TaskDto, String> {
|
||||
db_insert_task(
|
||||
&state.db,
|
||||
&request.id,
|
||||
@@ -76,7 +76,15 @@ pub async fn create_task_cmd(
|
||||
request.source_transcript_id.as_deref(),
|
||||
)
|
||||
.await
|
||||
.map_err(|e| e.to_string())
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
// Fetch the freshly-inserted row so the frontend can stop doing
|
||||
// client-side object construction. Mirrors list_tasks_cmd's shape.
|
||||
db_get_task(&state.db, &request.id)
|
||||
.await
|
||||
.map_err(|e| e.to_string())?
|
||||
.map(TaskDto::from)
|
||||
.ok_or_else(|| format!("Task {} not found after insert", request.id))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
|
||||
Reference in New Issue
Block a user