Skip to content

Commit

Permalink
fix: response data struct
Browse files Browse the repository at this point in the history
  • Loading branch information
Serein207 committed Aug 4, 2024
1 parent 002225d commit e149027
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/Infrastructure/Network/NetworkClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ JsonResult NetworkClient::handleResponse(http::response<http::dynamic_body> resp
}

nlohmann::basic_json<> res;
debug(), res.dump();

try {
res = nlohmann::json::parse(beast::buffers_to_string(response.body().data()));
debug(), res.dump();
} catch (const nlohmann::json::parse_error& e) {
return Err(Error(Error::JsonDes, e.what()));
}
Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/Network/Response/LoginResEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace evento {
struct LoginResEntity {
std::string accessToken; // expires in 1 hour
std::string refreshToken; // expires in 7 days, save it!
UserInfoEntity user;
UserInfoEntity userInfo;

NLOHMANN_DEFINE_TYPE_INTRUSIVE(LoginResEntity, accessToken, refreshToken, user);
NLOHMANN_DEFINE_TYPE_INTRUSIVE(LoginResEntity, accessToken, refreshToken, userInfo);
};

} // namespace evento
2 changes: 1 addition & 1 deletion src/Infrastructure/Network/network.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void start_sast_link() {
std::string const service = "refresh-token";

keychain::Error err;
keychain::setPassword(package, service, entity.user.id, entity.refreshToken, err);
keychain::setPassword(package, service, entity.userInfo.id, entity.refreshToken, err);

if (err.code != 0) {
spdlog::error("Failed to save refresh token: {}\n", err.message);
Expand Down

0 comments on commit e149027

Please sign in to comment.