LD-Converter/src-tauri/src/commands/history.rs

19 lines
481 B
Rust

use tauri::State;
use crate::error::AppResult;
use crate::models::HistoryEntry;
use crate::state::AppState;
#[tauri::command]
pub async fn get_history(state: State<'_, AppState>) -> AppResult<Vec<HistoryEntry>> {
let r = state.history.read().await;
Ok(r.clone())
}
#[tauri::command]
pub async fn clear_history(state: State<'_, AppState>) -> AppResult<()> {
let mut w = state.history.write().await;
w.clear();
AppState::save_history_to_disk(&w);
Ok(())
}