mirror of
https://github.com/Shchoholiev/shopping-assistant-web-client.git
synced 2025-04-04 16:49:36 +00:00
Merge remote-tracking branch 'origin/develop' into SA-106-wishlists-cart-pages
This commit is contained in:
commit
0f2d183f55
@ -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())
|
||||
);
|
||||
|
||||
|
@ -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) });
|
||||
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"ApiUrl": "https://shopping-assistant-api-dev.azurewebsites.net/"
|
||||
}
|
||||
}
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user