remove useless variables
This commit is contained in:
parent
32835f2882
commit
b72cfae8df
14
src/net.cpp
14
src/net.cpp
@ -31,14 +31,10 @@ size_t WriteCallback(void *contents, size_t size, size_t nmemb,
|
||||
std::string send_curl_request(std::string endpoint, std::string type,
|
||||
std::string req_data) {
|
||||
std::string response;
|
||||
std::string surl = baka_api_url + endpoint;
|
||||
|
||||
const char *url = surl.c_str();
|
||||
|
||||
const char *req_data_m = req_data.c_str();
|
||||
std::string url = baka_api_url + endpoint;
|
||||
|
||||
if (curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
|
||||
|
||||
@ -46,7 +42,7 @@ std::string send_curl_request(std::string endpoint, std::string type,
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, req_data_m);
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, req_data.c_str());
|
||||
|
||||
struct curl_slist *headers = NULL;
|
||||
headers = curl_slist_append(
|
||||
@ -101,8 +97,10 @@ void login(std::string username, std::string password) {
|
||||
std::cerr << "cannot access ~/.local/share/bakatui\n";
|
||||
safe_exit(100);
|
||||
}
|
||||
|
||||
std::string authfile_path = std::string(savedir_path) + "/auth";
|
||||
std::ofstream authfile;
|
||||
authfile.open(savedir_path);
|
||||
authfile.open(authfile_path);
|
||||
authfile << response;
|
||||
authfile.close();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user