adds reactivity when undoing an event
This commit is contained in:
11
src/api.rs
11
src/api.rs
@@ -198,9 +198,14 @@ pub fn execute(
|
||||
None
|
||||
}
|
||||
ApiActions::UndoLastAction(id) => {
|
||||
match db::undo_last_action(conn, id) {
|
||||
Ok(ev) => response.notify(format!("'{}' annulé(e)", ev.name())),
|
||||
Err(e) => response.push_error(format!("Erreur : {:?}", e)),
|
||||
if let Ok(event) = db::models::history::get_last_of_player(conn, id) {
|
||||
let name = String::from(event.name());
|
||||
for undone in event.undo(conn)?.into_inner().into_iter() {
|
||||
response.push_update(undone);
|
||||
}
|
||||
response.notify(format!("'{}' annulé(e)", name));
|
||||
} else {
|
||||
response.push_error("Aucune action trouvée")
|
||||
};
|
||||
None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user