forked from organicmaps/organicmaps
[booking] Destroy booking api connection
This commit is contained in:
parent
8d87825476
commit
098ca2f3a9
2 changed files with 7 additions and 5 deletions
|
@ -1,7 +1,5 @@
|
|||
#include "map/booking_api.hpp"
|
||||
|
||||
#include "platform/http_request.hpp"
|
||||
|
||||
#include "base/gmtime.hpp"
|
||||
#include "base/logging.hpp"
|
||||
|
||||
|
@ -47,7 +45,7 @@ void BookingApi::GetMinPrice(string const & hotelId, string const & currency,
|
|||
{"currency_code", currency},
|
||||
{"arrival_date", dateArrival},
|
||||
{"departure_date", dateDeparture}});
|
||||
auto const callback = [fn, currency](downloader::HttpRequest & answer)
|
||||
auto const callback = [this, fn, currency](downloader::HttpRequest & answer)
|
||||
{
|
||||
|
||||
string minPrice;
|
||||
|
@ -96,9 +94,10 @@ void BookingApi::GetMinPrice(string const & hotelId, string const & currency,
|
|||
priceCurrency.clear();
|
||||
}
|
||||
fn(minPrice, priceCurrency);
|
||||
m_request.reset();
|
||||
};
|
||||
|
||||
downloader::HttpRequest::Get(url, callback);
|
||||
m_request.reset(downloader::HttpRequest::Get(url, callback));
|
||||
}
|
||||
|
||||
string BookingApi::MakeApiUrl(string const & func,
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include "platform/http_request.hpp"
|
||||
|
||||
#include "std/function.hpp"
|
||||
#include "std/initializer_list.hpp"
|
||||
#include "std/map.hpp"
|
||||
#include "std/string.hpp"
|
||||
#include "std/unique_ptr.hpp"
|
||||
#include "std/utility.hpp"
|
||||
|
||||
class BookingApi
|
||||
|
@ -21,5 +23,6 @@ public:
|
|||
function<void(string const &, string const &)> const & fn);
|
||||
|
||||
protected:
|
||||
unique_ptr<downloader::HttpRequest> m_request;
|
||||
string MakeApiUrl(string const & func, initializer_list<pair<string, string>> const & params);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue