diff options
Diffstat (limited to 'src/callbacks.rs')
-rw-r--r-- | src/callbacks.rs | 18 |
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; + }, + _ => {} + }; +} |