Merge remote-tracking branch 'origin/develop' into SA-106-wishlists-cart-pages

This commit is contained in:
AndriiSyrotenko 2023-11-02 18:38:40 +00:00
commit 0f2d183f55
4 changed files with 6 additions and 7 deletions

View File

@ -15,7 +15,7 @@ public static class DependencyInjectionExtension
client.BaseAddress = new Uri(apiUrl + "api/");
});
services.AddScoped<GraphQLHttpClient>(p =>
services.AddSingleton<GraphQLHttpClient>(p =>
new GraphQLHttpClient(apiUrl + "graphql", new NewtonsoftJsonSerializer())
);

View File

@ -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<dynamic>(request);
var jsonResponse = JsonConvert.SerializeObject(response.Data.refreshUserToken);
var jsonResponse = JsonConvert.SerializeObject(response.Data.refreshAccessToken);
var tokens = JsonConvert.DeserializeObject<TokensModel>(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) });

View File

@ -1,3 +1,3 @@
{
"ApiUrl": "https://shopping-assistant-api-dev.azurewebsites.net/"
}
}

View File

@ -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