Updated Controller structuring.

This commit is contained in:
Harrison Deng 2021-07-24 02:32:30 -05:00
parent 2c90678141
commit 4476b1b3e1
3 changed files with 16 additions and 8 deletions

View File

@ -0,0 +1,11 @@
using Microsoft.AspNetCore.Mvc;
namespace Props.Controllers
{
[ApiController]
[Route("api/[Controller]")]
public class ApiControllerBase : ControllerBase
{
}
}

View File

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

View File

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