summaryrefslogtreecommitdiff
path: root/src/callbacks.rs
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-08-05 19:00:37 +0200
committerSanto Cariotti <santo@dcariotti.me>2021-08-05 19:00:37 +0200
commit429489349688ce452f124a691c7542d2ca2177d1 (patch)
treee2f124dc11a1bf92f13e172f267ae9ae42e07f53 /src/callbacks.rs
parent51ea2896cdcdf7b6027f96421a0ce2b454486e03 (diff)
feat: handle the callback of the faculty
Diffstat (limited to 'src/callbacks.rs')
-rw-r--r--src/callbacks.rs18
1 files changed, 18 insertions, 0 deletions
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;
+ },
+ _ => {}
+ };
+}