From 4476b1b3e10db5906924681ce0261bc14dedc797 Mon Sep 17 00:00:00 2001 From: Harrison Deng Date: Sat, 24 Jul 2021 02:32:30 -0500 Subject: [PATCH] Updated Controller structuring. --- Props/Controllers/ApiControllerBase.cs | 11 +++++++++++ Props/Controllers/SearchController.cs | 9 +++------ Props/assets/js/specific/search.js | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 Props/Controllers/ApiControllerBase.cs diff --git a/Props/Controllers/ApiControllerBase.cs b/Props/Controllers/ApiControllerBase.cs new file mode 100644 index 0000000..90968c3 --- /dev/null +++ b/Props/Controllers/ApiControllerBase.cs @@ -0,0 +1,11 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Props.Controllers +{ + [ApiController] + [Route("api/[Controller]")] + public class ApiControllerBase : ControllerBase + { + + } +} \ No newline at end of file diff --git a/Props/Controllers/SearchController.cs b/Props/Controllers/SearchController.cs index 16a01e9..9ab8abd 100644 --- a/Props/Controllers/SearchController.cs +++ b/Props/Controllers/SearchController.cs @@ -4,9 +4,7 @@ using Props.Services.Modules; namespace Props.Controllers { - [ApiController] - [Route("api/[Controller]")] - public class SearchController : ControllerBase + public class SearchController : ApiControllerBase { private SearchOutline defaultOutline = new SearchOutline(); IShopManager shopManager; @@ -23,16 +21,15 @@ namespace Props.Controllers return Ok(shopManager.AvailableShops()); } - [HttpGet] - [Route("Default/Outline/Filters")] + [Route("Default/Filters")] public IActionResult GetDefaultFilters() { return Ok(defaultOutline.Filters); } [HttpGet] - [Route("Default/Outline/DisabledShops")] + [Route("Default/DisabledShops")] public IActionResult GetDefaultDisabledShops() { return Ok(defaultOutline.Disabled); diff --git a/Props/assets/js/specific/search.js b/Props/assets/js/specific/search.js index a8aaf2f..f8a8e29 100644 --- a/Props/assets/js/specific/search.js +++ b/Props/assets/js/specific/search.js @@ -19,7 +19,7 @@ let inputs = { async function main() { setupInteractiveBehavior(); - await setupInitialValues((await apiHttp.get("/Search/Default/Outline/Filters")).data); + await setupInitialValues((await apiHttp.get("/Search/Default/Filters")).data); await setupShopToggles((await apiHttp.get("/Search/Shops/Available")).data); document.querySelector("#configuration .invisible").classList.remove("invisible"); // Load completed, show the UI. @@ -88,7 +88,7 @@ async function setupInitialValues(filters) { } async function setupShopToggles(availableShops) { - let disabledShops = (await apiHttp.get("/Search/Default/Outline/DisabledShops")).data; + let disabledShops = (await apiHttp.get("/Search/Default/DisabledShops")).data; let shopsElem = document.getElementById("shop-checkboxes"); availableShops.forEach(shopName => { let id = `${shopName}-enabled`;