diff --git a/ShoppingAssistantWebClient.Web/Configurations/DependencyInjectionExtension.cs b/ShoppingAssistantWebClient.Web/Configurations/DependencyInjectionExtension.cs index b50cb1d..1d73548 100644 --- a/ShoppingAssistantWebClient.Web/Configurations/DependencyInjectionExtension.cs +++ b/ShoppingAssistantWebClient.Web/Configurations/DependencyInjectionExtension.cs @@ -15,7 +15,7 @@ public static class DependencyInjectionExtension client.BaseAddress = new Uri(apiUrl + "api/"); }); - services.AddScoped(p => + services.AddSingleton(p => new GraphQLHttpClient(apiUrl + "graphql", new NewtonsoftJsonSerializer()) ); diff --git a/ShoppingAssistantWebClient.Web/Network/AuthenticationService.cs b/ShoppingAssistantWebClient.Web/Network/AuthenticationService.cs index c248421..0ff1c72 100644 --- a/ShoppingAssistantWebClient.Web/Network/AuthenticationService.cs +++ b/ShoppingAssistantWebClient.Web/Network/AuthenticationService.cs @@ -171,8 +171,8 @@ public class AuthenticationService var request = new GraphQLRequest { Query = @" - mutation RefreshToken($model: TokensModelInput!) { - refreshUserToken(model: $model) { + mutation RefreshAccessToken($model: TokensModelInput!) { + refreshAccessToken(model: $model) { accessToken refreshToken } @@ -180,7 +180,7 @@ public class AuthenticationService Variables = new { model = new { accessToken = accessToken, refreshToken = refreshToken } } }; var response = await _graphQLClient.SendMutationAsync(request); - var jsonResponse = JsonConvert.SerializeObject(response.Data.refreshUserToken); + var jsonResponse = JsonConvert.SerializeObject(response.Data.refreshAccessToken); var tokens = JsonConvert.DeserializeObject(jsonResponse); _httpContext.Response.Cookies.Append("accessToken", tokens.AccessToken, new CookieOptions { Expires = DateTime.UtcNow.AddDays(180) }); _httpContext.Response.Cookies.Append("refreshToken", tokens.RefreshToken, new CookieOptions { Expires = DateTime.UtcNow.AddDays(180) }); diff --git a/ShoppingAssistantWebClient.Web/appsettings.Development.json b/ShoppingAssistantWebClient.Web/appsettings.Development.json index f4f718c..04081f7 100644 --- a/ShoppingAssistantWebClient.Web/appsettings.Development.json +++ b/ShoppingAssistantWebClient.Web/appsettings.Development.json @@ -1,3 +1,3 @@ { "ApiUrl": "https://shopping-assistant-api-dev.azurewebsites.net/" -} \ No newline at end of file + } \ No newline at end of file diff --git a/ShoppingAssistantWebClient.sln b/ShoppingAssistantWebClient.sln index 3c49ca4..4af2c89 100644 --- a/ShoppingAssistantWebClient.sln +++ b/ShoppingAssistantWebClient.sln @@ -1,9 +1,8 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.7.34003.232 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShoppingAssistantWebClient.Web.Old", "ShoppingAssistantWebClient.Web\ShoppingAssistantWebClient.Web.csproj", "{7D1CD0CD-916A-4007-A4BB-15EA99357992}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShoppingAssistantWebClient.Web", "ShoppingAssistantWebClient.Web\ShoppingAssistantWebClient.Web.csproj", "{7D1CD0CD-916A-4007-A4BB-15EA99357992}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution