1
0
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:
2021-05-13 08:42:59 +02:00
parent add56a9a6d
commit 830c6d0700
3 changed files with 37 additions and 3 deletions

View File

@ -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))
}