mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-07-06 15:52:48 +00:00
Update get_admin_info route
This commit is contained in:
@ -53,7 +53,18 @@ pub fn get_admin_id(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
|
||||
/// Get current admin information
|
||||
pub fn get_admin_info(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
let admin = admin_account_helper::find_admin_by_id(r.admin_id()?)?;
|
||||
let admin = match r.has_post_parameter("id") {
|
||||
false => admin_account_helper::find_admin_by_id(r.admin_id()?)?,
|
||||
true => {
|
||||
let admin_id = r.post_admin_id("id")?;
|
||||
|
||||
if admin_id == r.admin_id()? {
|
||||
admin_account_helper::find_admin_by_id(admin_id)?
|
||||
} else {
|
||||
unimplemented!();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
r.set_response(AdminInfoAPI::new(&admin))
|
||||
}
|
Reference in New Issue
Block a user