Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Clear cart returns html instead of json #258 (#272)
Krzysztof Pajakba36c0013a3e
diff --git a/src/Web/Grand.Web/Controllers/BasePublicController.cs b/src/Web/Grand.Web/Controllers/BasePublicController.csindex 07eba20ed..cfee5c8ef 100644--- a/src/Web/Grand.Web/Controllers/BasePublicController.cs+++ b/src/Web/Grand.Web/Controllers/BasePublicController.cs@@ -41,5 +41,13 @@ namespace Grand.Web.Controllersreturn base.View(viewName, model);}++ public override RedirectToRouteResult RedirectToRoute(string routeName)+ {+ if (IsJsonResponseView())+ return RedirectToRoute("Route", new { routeName = routeName });++ return base.RedirectToRoute(routeName);+ }}}diff --git a/src/Web/Grand.Web/Controllers/CommonController.cs b/src/Web/Grand.Web/Controllers/CommonController.csindex 921186ebe..45befed69 100644--- a/src/Web/Grand.Web/Controllers/CommonController.cs+++ b/src/Web/Grand.Web/Controllers/CommonController.cs@@ -127,6 +127,16 @@ namespace Grand.Web.Controllersreturn View();}+ public virtual IActionResult Route(string routeName)+ {+ if (string.IsNullOrEmpty(routeName))+ return Json(new { redirectToUrl = string.Empty });++ var url = Url.RouteUrl(routeName);++ return Json(new { redirectToUrl = url });+ }+//external authentication errorpublic virtual IActionResult ExternalAuthenticationError(IEnumerable<string> errors){diff --git a/src/Web/Grand.Web/Endpoints/EndpointProvider.cs b/src/Web/Grand.Web/Endpoints/EndpointProvider.csindex 34065f149..d68b240e6 100644--- a/src/Web/Grand.Web/Endpoints/EndpointProvider.cs+++ b/src/Web/Grand.Web/Endpoints/EndpointProvider.cs@@ -404,6 +404,11 @@ namespace Grand.Web.Endpointspattern + "access-denied",new { controller = "Common", action = "AccessDenied" });+ //page not found+ endpointRouteBuilder.MapControllerRoute("Route",+ "route",+ new { controller = "Common", action = "Route" });+//lets encryptendpointRouteBuilder.MapControllerRoute("well-known",".well-known/pki-validation/{fileName}",