Added new notification nuget. Added auto regenerate JWT token on error.

This commit is contained in:
Patrick Fic
2020-07-24 11:14:51 -07:00
parent e8c58dab2f
commit 32ec745c77
8 changed files with 123 additions and 48 deletions

View File

@@ -34,8 +34,18 @@ namespace BodyshopPartner.Utils
else
{
string exceptionString = "";
bool jwtExpired = false;
logger.Error("Error executing query.");
Array.ForEach(graphQLResponse.Errors, x => { logger.Error(x.Message); exceptionString = exceptionString + x + ";"; });
Array.ForEach(graphQLResponse.Errors, x =>
{
logger.Error(x.Message);
if (x.Message.Contains("JWTExpired"))
{
jwtExpired = true;
};
exceptionString = exceptionString + x + ";";
});
if (jwtExpired) await Utils.Auth.Refresh(); ;
logger.Error("---------------------");
throw new Exception(exceptionString);
}