mirror of
https://github.com/Mercantec-GHC/h4-projekt-gruppe-0-sm.git
synced 2025-04-27 16:24:07 +02:00
work on add balance
This commit is contained in:
parent
2d74a872fe
commit
b811c208c9
@ -60,3 +60,25 @@ void route_post_users_register(HttpCtx* ctx)
|
||||
users_register_req_destroy(&req);
|
||||
RESPOND_JSON(ctx, 200, "{\"ok\":true}");
|
||||
}
|
||||
|
||||
void route_add_balance(HttpCtx* ctx)
|
||||
{
|
||||
Cx* cx = http_ctx_user_ctx(ctx);
|
||||
const Session* session = middleware_session(ctx);
|
||||
if (!session)
|
||||
return;
|
||||
printf("token: %s\n user_id: %ld\n", session->token, session->user_id);
|
||||
|
||||
const char* body_str = http_ctx_req_body(ctx);
|
||||
JsonValue* body_json = json_parse(body_str, strlen(body_str));
|
||||
if (!body_json) {
|
||||
RESPOND_BAD_REQUEST(ctx, "bad request");
|
||||
return;
|
||||
}
|
||||
json_free(body_json);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user