Decoder changes for adjustrite.
This commit is contained in:
@@ -45,48 +45,59 @@ namespace BodyshopPartner.Utils
|
||||
|
||||
try
|
||||
{
|
||||
// httpClient.PostAsync("https://api.imex.online/ioevent", content);
|
||||
// httpClient.PostAsync("https://api.imex.online/ioevent", content);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex,"Unable to post to IOEVENT.");
|
||||
logger.Error(ex, "Unable to post to IOEVENT.");
|
||||
}
|
||||
|
||||
var graphQLResponse = await g.SendQueryAsync<dynamic>(r);
|
||||
|
||||
if (graphQLResponse.Errors == null)
|
||||
try
|
||||
{
|
||||
|
||||
//logger.Trace("GQL Response: {0}", graphQLResponse.Data);
|
||||
return graphQLResponse.Data;
|
||||
}
|
||||
else
|
||||
{
|
||||
string exceptionString = "";
|
||||
bool jwtExpired = false;
|
||||
logger.Error("Error executing query.");
|
||||
Array.ForEach(graphQLResponse.Errors, x =>
|
||||
{
|
||||
logger.Error("Graphql Error: " + x.Message);
|
||||
if (x.Message.Contains("JWTExpired"))
|
||||
{
|
||||
jwtExpired = true;
|
||||
};
|
||||
exceptionString = exceptionString + x + ";";
|
||||
});
|
||||
if (jwtExpired && !lastTry)
|
||||
var graphQLResponse = await g.SendQueryAsync<dynamic>(r);
|
||||
logger.Debug("Graphql response:");
|
||||
logger.Debug("Data: " + graphQLResponse.Data);
|
||||
logger.Debug("Error: " + graphQLResponse.Errors);
|
||||
if (graphQLResponse.Errors == null)
|
||||
{
|
||||
await Utils.Auth.Refresh();
|
||||
return (ExecuteQuery(r, true));
|
||||
|
||||
//logger.Trace("GQL Response: {0}", graphQLResponse.Data);
|
||||
return graphQLResponse.Data;
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.Error("---------------------");
|
||||
throw new Exception(exceptionString);
|
||||
}
|
||||
string exceptionString = "";
|
||||
bool jwtExpired = false;
|
||||
logger.Error("Error executing query.");
|
||||
Array.ForEach(graphQLResponse.Errors, x =>
|
||||
{
|
||||
logger.Error("Graphql Error: " + x.Message);
|
||||
if (x.Message.Contains("JWTExpired"))
|
||||
{
|
||||
jwtExpired = true;
|
||||
};
|
||||
exceptionString = exceptionString + x + ";";
|
||||
});
|
||||
if (jwtExpired && !lastTry)
|
||||
{
|
||||
await Utils.Auth.Refresh();
|
||||
return (ExecuteQuery(r, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.Error("---------------------");
|
||||
throw new Exception(exceptionString);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error("Error firing GQL query.");
|
||||
logger.Error(ex);
|
||||
throw ex;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user