From 429489349688ce452f124a691c7542d2ca2177d1 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Thu, 5 Aug 2021 19:00:37 +0200 Subject: feat: handle the callback of the faculty --- src/callbacks.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/callbacks.rs (limited to 'src/callbacks.rs') diff --git a/src/callbacks.rs b/src/callbacks.rs new file mode 100644 index 0000000..c670884 --- /dev/null +++ b/src/callbacks.rs @@ -0,0 +1,18 @@ +use crate::browser; + +/// Handle the string of callback data +pub async fn handler(text: &String) { + let call: Vec<&str> = text.split("_").collect(); + + // First part of `_` string is the type of callback we want to handle + let type_ = call[0]; + + match type_ { + "faculty" => unsafe { + // Select the faculty + let _ = + browser::select_option("select2-results__option", "data-select2-id", call[1]).await; + }, + _ => {} + }; +} -- cgit v1.2.3-18-g5258