|  |  | @ -67,24 +67,24 @@ QString create_jwt(const QJsonObject &payloads, int expiry) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | }  // namespace CommaApi
 |  |  |  | }  // namespace CommaApi
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | HttpRequest::HttpRequest(QObject *parent, const QString &requestURL, bool create_jwt_, |  |  |  | HttpRequest::HttpRequest(QObject *parent, bool create_jwt, int timeout) : create_jwt(create_jwt), QObject(parent) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                          int timeout) : create_jwt(create_jwt_), QObject(parent) { |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   networkAccessManager = new QNetworkAccessManager(this); |  |  |  |   networkAccessManager = new QNetworkAccessManager(this); | 
			
		
	
		
		
			
				
					
					|  |  |  |   reply = NULL; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   networkTimer = new QTimer(this); |  |  |  |   networkTimer = new QTimer(this); | 
			
		
	
		
		
			
				
					
					|  |  |  |   networkTimer->setSingleShot(true); |  |  |  |   networkTimer->setSingleShot(true); | 
			
		
	
		
		
			
				
					
					|  |  |  |   networkTimer->setInterval(timeout); |  |  |  |   networkTimer->setInterval(timeout); | 
			
		
	
		
		
			
				
					
					|  |  |  |   connect(networkTimer, &QTimer::timeout, this, &HttpRequest::requestTimeout); |  |  |  |   connect(networkTimer, &QTimer::timeout, this, &HttpRequest::requestTimeout); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   sendRequest(requestURL); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | bool HttpRequest::active() { |  |  |  | bool HttpRequest::active() { | 
			
		
	
		
		
			
				
					
					|  |  |  |   return reply != NULL; |  |  |  |   return reply != nullptr; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | void HttpRequest::sendRequest(const QString &requestURL) { |  |  |  | void HttpRequest::sendRequest(const QString &requestURL) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   if (active()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     qDebug() << "HttpRequest is active"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     return; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |   QString token; |  |  |  |   QString token; | 
			
		
	
		
		
			
				
					
					|  |  |  |   if(create_jwt) { |  |  |  |   if(create_jwt) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     token = CommaApi::create_jwt(); |  |  |  |     token = CommaApi::create_jwt(); | 
			
		
	
	
		
		
			
				
					|  |  | @ -129,5 +129,5 @@ void HttpRequest::requestFinished() { | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |   emit requestDone(success); |  |  |  |   emit requestDone(success); | 
			
		
	
		
		
			
				
					
					|  |  |  |   reply->deleteLater(); |  |  |  |   reply->deleteLater(); | 
			
		
	
		
		
			
				
					
					|  |  |  |   reply = NULL; |  |  |  |   reply = nullptr; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |