@Products[currentProduct].Name
+@Products[currentProduct].Description
+ + +diff --git a/.vscode/settings.json b/.vscode/settings.json index c504a4e..35336bf 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ -{ - "explorer.fileNesting.enabled": true, - "explorer.fileNesting.patterns": { - "*.cshtml": "${capture}.cshtml, ${capture}.cshtml.cs, ${capture}.cshtml.css", - "*.razor": "${capture}.razor, ${capture}.razor.css,${capture}.razor.cs" - } +{ + "explorer.fileNesting.enabled": true, + "explorer.fileNesting.patterns": { + "*.cshtml": "${capture}.cshtml, ${capture}.cshtml.cs, ${capture}.cshtml.css", + "*.razor": "${capture}.razor, ${capture}.razor.css,${capture}.razor.cs" + } } \ No newline at end of file diff --git a/ShoppingAssistantWebClient.Web/CustomMiddlewares/GlobalUserMiddleware.cs b/ShoppingAssistantWebClient.Web/CustomMiddlewares/GlobalUserMiddleware.cs index 7fc6790..2b01c54 100644 --- a/ShoppingAssistantWebClient.Web/CustomMiddlewares/GlobalUserMiddleware.cs +++ b/ShoppingAssistantWebClient.Web/CustomMiddlewares/GlobalUserMiddleware.cs @@ -13,26 +13,28 @@ public class GlobalUserMiddleware this._next = next; } - public async Task InvokeAsync(HttpContext httpContext, AuthenticationService authenticationService, ApiClient apiClient) +public async Task InvokeAsync(HttpContext httpContext, AuthenticationService authenticationService, ApiClient apiClient) { - try + if (httpContext.Request.Path != "/login") { - var accessToken = await authenticationService.GetAuthTokenAsync(); - if (!string.IsNullOrEmpty(accessToken)) + try { - apiClient.JwtToken = accessToken; - GlobalUser.Roles = authenticationService.GetRolesFromJwtToken(accessToken); - GlobalUser.Id = authenticationService.GetIdFromJwtToken(accessToken); - GlobalUser.Email = authenticationService.GetEmailFromJwtToken(accessToken); - GlobalUser.Phone = authenticationService.GetPhoneFromJwtToken(accessToken); + var accessToken = await authenticationService.GetAuthTokenAsync(); + if (!string.IsNullOrEmpty(accessToken)) + { + apiClient.JwtToken = accessToken; + GlobalUser.Roles = authenticationService.GetRolesFromJwtToken(accessToken); + GlobalUser.Id = authenticationService.GetIdFromJwtToken(accessToken); + GlobalUser.Email = authenticationService.GetEmailFromJwtToken(accessToken); + GlobalUser.Phone = authenticationService.GetPhoneFromJwtToken(accessToken); + } + } + catch (AuthenticationException ex) + { + httpContext.Response.Cookies.Delete("accessToken"); + httpContext.Response.Redirect("/login"); } } - catch (AuthenticationException ex) - { - httpContext.Response.Cookies.Delete("accessToken"); - httpContext.Response.Redirect(""); - } - await _next(httpContext); } } \ No newline at end of file diff --git a/ShoppingAssistantWebClient.Web/Models/Product.cs b/ShoppingAssistantWebClient.Web/Models/Product.cs index bff5020..ef0e20a 100644 --- a/ShoppingAssistantWebClient.Web/Models/Product.cs +++ b/ShoppingAssistantWebClient.Web/Models/Product.cs @@ -1,20 +1,20 @@ -namespace ShoppingAssistantWebClient.Web.Models; - -public class Product -{ - public required string Id {get; set;} - - public required string Url {get; set;} - - public required string Name {get; set;} - - public required string Description {get; set;} - - public required double Rating {get; set;} - - public required string[] ImagesUrls {get; set;} - - public required bool WasOpened {get; set;} - - public required string WishlistId {get; set;} +namespace ShoppingAssistantWebClient.Web.Models; + +public class Product +{ + public required string Id {get; set;} + + public required string Url {get; set;} + + public required string Name {get; set;} + + public required string Description {get; set;} + + public required double Rating {get; set;} + + public required string[] ImagesUrls {get; set;} + + public required bool WasOpened {get; set;} + + public required string WishlistId {get; set;} } \ No newline at end of file diff --git a/ShoppingAssistantWebClient.Web/Models/Wishlist.cs b/ShoppingAssistantWebClient.Web/Models/Wishlist.cs index fc93e8f..bf09f01 100644 --- a/ShoppingAssistantWebClient.Web/Models/Wishlist.cs +++ b/ShoppingAssistantWebClient.Web/Models/Wishlist.cs @@ -1,12 +1,12 @@ -namespace ShoppingAssistantWebClient.Web.Models; - -public class Wishlist -{ - public required string Id {get; set;} - - public required string Name {get; set;} - - public required string Type {get; set;} - - public required string CreateById {get; set;} +namespace ShoppingAssistantWebClient.Web.Models; + +public class Wishlist +{ + public required string Id {get; set;} + + public required string Name {get; set;} + + public required string Type {get; set;} + + public required string CreateById {get; set;} } \ No newline at end of file diff --git a/ShoppingAssistantWebClient.Web/Pages/Cards.razor b/ShoppingAssistantWebClient.Web/Pages/Cards.razor new file mode 100644 index 0000000..6237394 --- /dev/null +++ b/ShoppingAssistantWebClient.Web/Pages/Cards.razor @@ -0,0 +1,86 @@ +@page "/cards" + +
Gift for Jessica
+@Products[currentProduct].Name
+@Products[currentProduct].Description
+ + +Cart
+Give me product recommendation. Ask me questions if you need more directions. I am looking for: hub for my macbook to connect external monitors
-Sure! I can help you with that. I will ask you some leading questions. This is the first:
-
- How many external monitors do you want to connect to your MacBook?
7
-Thank you. Here is the next question:
-
- What type of external monitors do you have? (e.g., HDMI, DisplayPort, VGA)
- Request ID: @Model.RequestId
-
- Swapping to the Development environment displays detailed information about the error that occurred. -
-- The Development environment shouldn't be enabled for deployed applications. - It can result in displaying sensitive information from exceptions to end users. - For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development - and restarting the app. -
-- | Chat name | -Type | -CreatedById | -- |
---|---|---|---|---|
@Html.DisplayFor(modelItem => item.Name) | -@Html.DisplayFor(modelItem => item.Type) | -@Html.DisplayFor(modelItem => item.CreateById) | - -
- | Chat name | -Type | -CreatedById | -- |
---|---|---|---|---|
@item.Name | -@item.Type | -@item.CreateById | - -