review and change from auto to needed type

This commit is contained in:
wt committed 2024-05-24 16:36:08 +07:00
1 parent 5b1e7464c2
commit da7ccbd802
7 files changed
+14 -14

No files matched your search

+2 -2
View File
@@ -7,7 +7,7 @@ void get_all_users(const httplib::Request& request, httplib::Response& response)
if (json_body["token"] == nullptr) {response.set_content("{\"required\":\"[token]\"}", "application/json");return;}
if (!verify_auth(json_body["token"])) {response.set_content("{\"status\":\"403\"}", "application/json");return;}
auto decoded_token = jwt::decode(json_body["token"]);
jwt::decoded_jwt<jwt::traits::kazuho_picojson> decoded_token = jwt::decode(json_body["token"]);
std::string userid = "";
for (auto& e : decoded_token.get_payload_json()) {
if (e.first == "userId") {
@@ -20,7 +20,7 @@ void get_all_users(const httplib::Request& request, httplib::Response& response)
nlohmann::json all_users = nlohmann::json::parse(usersfile);
usersfile.close();
nlohmann::json response_user_data = nullptr;
for (auto& user : all_users) {
for (nlohmann::json& user : all_users) {
if (user["id"] == userid) {
response_user_data = user;
}