summaryrefslogtreecommitdiff
path: root/src/callbacks.rs
blob: c6708840d0bf6c57e6d3b2455ce6945d989fbe80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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;
        },
        _ => {}
    };
}