IO-1162 Retry query on JWT expiration
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user