Clean export callbacks

This commit is contained in:
Emilia Allison 2024-08-03 18:42:00 -04:00
parent 194b78430c
commit b78336def0
Signed by: emilia
GPG Key ID: 7A3F8997BFE894E0
1 changed files with 5 additions and 6 deletions

View File

@ -2,18 +2,18 @@
use js_sys::Array;
use wasm_bindgen::{prelude::*, JsCast, JsValue};
use wasm_bindgen::{JsCast, JsValue};
use web_sys::{
Blob, HtmlAnchorElement, HtmlDialogElement, HtmlElement, HtmlFormElement, HtmlInputElement, Url,
Blob, HtmlAnchorElement, Url,
};
use yew::prelude::*;
use yewdux::prelude::*;
use crate::components::states::{CurrentTransfer, MainState};
use crate::components::states::MainState;
use crate::state_to_csv;
type NoParamsCallback = Box<dyn Fn(())>;
// type NoParamsCallback = Box<dyn Fn(())>;
pub fn export_csv_button_callback(main_state: std::rc::Rc<MainState>) -> Callback<MouseEvent> {
Callback::from(move |_| {
@ -24,7 +24,6 @@ pub fn export_csv_button_callback(main_state: std::rc::Rc<MainState>) -> Callbac
.unwrap();
return;
}
web_sys::window().unwrap().alert_with_message("CSV export is currently not importable. Export as JSON if you'd like to back up your work!").unwrap();
if let Ok(csv) = state_to_csv(&main_state) {
save_str(&csv, "transfers.csv");
}