diff options
| author | Aotrix <[email protected]> | 2025-11-01 19:29:44 +0100 |
|---|---|---|
| committer | Aotrix <[email protected]> | 2025-11-01 19:29:44 +0100 |
| commit | 2d67036e6eede970efb0db5f9793de95093599cd (patch) | |
| tree | e9a139d6435cc7eeece182307a72bee24c7f91d4 /subprojects/battleNetApi/src/token.cpp | |
| parent | 3baa8fa322dbc8f2a2183e8ac027387c75eb9180 (diff) | |
refactoring Token class
Diffstat (limited to 'subprojects/battleNetApi/src/token.cpp')
| -rw-r--r-- | subprojects/battleNetApi/src/token.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/subprojects/battleNetApi/src/token.cpp b/subprojects/battleNetApi/src/token.cpp index 7d2e20e..b1ec5bf 100644 --- a/subprojects/battleNetApi/src/token.cpp +++ b/subprojects/battleNetApi/src/token.cpp @@ -1,12 +1,13 @@ #include "token.hpp" #include <chrono> #include <curl/curl.h> -#include <format> #include <fstream> #include <iostream> #include <regex> -Token::Token(const std::string &iTokenFilePath) : mFilePath{iTokenFilePath} {} +Token::Token(const std::string &iTokenFilePath) : mFilePath{iTokenFilePath}, mToken{getValidToken()} {} + +std::string Token::toString() const { return mToken; } std::string Token::getValidToken() const { refreshToken(); @@ -18,8 +19,7 @@ std::string Token::getValidToken() const { } void Token::refreshToken() const { - std::string file_path = std::format("{}/resources/token_info.txt", SOURCE_DIR_PATH); - std::ifstream token_file(file_path); + std::ifstream token_file{mFilePath}; std::string line; std::getline(token_file, line); if (line.empty()) { |
