* using hashmap instead serde::ValueMap for extract_uid

This commit is contained in:
shockrah 2021-02-03 19:30:46 -08:00
parent 5737f9824d
commit e36d0e5823

View File

@ -53,8 +53,11 @@ pub fn parse_query_string<'qs>(string: &'qs str)
}
#[inline]
pub fn extract_uid(values: &Value) -> u64 {
// pulling 'id' from user params is safe because the
// auth modules guarantees this to be there already
values.get("id").unwrap().as_u64().unwrap()
pub fn extract_uid(values: &HashMap<&str, &str>) -> u64 {
// NOTE: this is only to be used _AFTER_ the auth module passes since it
// guarantees the id is verified
let map = *values;
let val = *map.get("id").unwrap();
let s: String = String::from(val);
return s.parse::<u64>().unwrap();
}