IO-1162 Retry query on JWT expiration

This commit is contained in:
Patrick Fic
2021-05-26 10:30:52 -07:00
parent 0ab4cc38d0
commit bfa68858e5

View File

@@ -22,7 +22,7 @@ namespace BodyshopPartner.Utils
return graphQLClient;
}
public static async Task<dynamic> ExecuteQuery(GraphQLRequest r)
public static async Task<dynamic> ExecuteQuery(GraphQLRequest r, bool lastTry = false)
{
using (var g = Utils.GraphQL.CreateGQLClient())
{
@@ -49,10 +49,16 @@ namespace BodyshopPartner.Utils
};
exceptionString = exceptionString + x + ";";
});
if (jwtExpired) await Utils.Auth.Refresh(); ;
if (jwtExpired && !lastTry) { await Utils.Auth.Refresh();
return (ExecuteQuery(r, true));
}
else
{
logger.Error("---------------------");
throw new Exception(exceptionString);
}
}
}
}
}