diff --git a/BodyshopUploader/Utils/GraphQL.cs b/BodyshopUploader/Utils/GraphQL.cs index 573a960..ac8bb58 100644 --- a/BodyshopUploader/Utils/GraphQL.cs +++ b/BodyshopUploader/Utils/GraphQL.cs @@ -22,7 +22,7 @@ namespace BodyshopPartner.Utils return graphQLClient; } - public static async Task ExecuteQuery(GraphQLRequest r) + public static async Task ExecuteQuery(GraphQLRequest r, bool lastTry = false) { using (var g = Utils.GraphQL.CreateGQLClient()) { @@ -49,9 +49,15 @@ namespace BodyshopPartner.Utils }; exceptionString = exceptionString + x + ";"; }); - if (jwtExpired) await Utils.Auth.Refresh(); ; - logger.Error("---------------------"); - throw new Exception(exceptionString); + if (jwtExpired && !lastTry) { await Utils.Auth.Refresh(); + return (ExecuteQuery(r, true)); + } + else + { + logger.Error("---------------------"); + throw new Exception(exceptionString); + } + } } }