Clean export callbacks
This commit is contained in:
parent
194b78430c
commit
b78336def0
|
@ -2,18 +2,18 @@
|
||||||
|
|
||||||
use js_sys::Array;
|
use js_sys::Array;
|
||||||
|
|
||||||
use wasm_bindgen::{prelude::*, JsCast, JsValue};
|
use wasm_bindgen::{JsCast, JsValue};
|
||||||
use web_sys::{
|
use web_sys::{
|
||||||
Blob, HtmlAnchorElement, HtmlDialogElement, HtmlElement, HtmlFormElement, HtmlInputElement, Url,
|
Blob, HtmlAnchorElement, Url,
|
||||||
};
|
};
|
||||||
use yew::prelude::*;
|
use yew::prelude::*;
|
||||||
use yewdux::prelude::*;
|
|
||||||
|
|
||||||
use crate::components::states::{CurrentTransfer, MainState};
|
|
||||||
|
use crate::components::states::MainState;
|
||||||
|
|
||||||
use crate::state_to_csv;
|
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> {
|
pub fn export_csv_button_callback(main_state: std::rc::Rc<MainState>) -> Callback<MouseEvent> {
|
||||||
Callback::from(move |_| {
|
Callback::from(move |_| {
|
||||||
|
@ -24,7 +24,6 @@ pub fn export_csv_button_callback(main_state: std::rc::Rc<MainState>) -> Callbac
|
||||||
.unwrap();
|
.unwrap();
|
||||||
return;
|
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) {
|
if let Ok(csv) = state_to_csv(&main_state) {
|
||||||
save_str(&csv, "transfers.csv");
|
save_str(&csv, "transfers.csv");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue