Implement ability to add login bonus things in webui

This commit is contained in:
Ethan O'Brien
2024-04-26 22:02:50 -05:00
parent 9ba429d0ae
commit c4d89059f0
7 changed files with 131 additions and 6 deletions

View File

@ -83,6 +83,19 @@ pub fn user(req: HttpRequest) -> HttpResponse {
.body(json::stringify(resp))
}
pub fn start_loginbonus(req: HttpRequest, body: String) -> HttpResponse {
let token = get_login_token(&req);
if token.is_none() {
return error("Not logged in");
}
let body = json::parse(&body).unwrap();
let resp = userdata::webui_start_loginbonus(body["bonus_id"].as_i64().unwrap(), &token.unwrap());
HttpResponse::Ok()
.insert_header(ContentType::json())
.body(json::stringify(resp))
}
pub fn logout(req: HttpRequest) -> HttpResponse {
let token = get_login_token(&req);
if !token.is_none() {