Updated Controller structuring.
This commit is contained in:
parent
2c90678141
commit
4476b1b3e1
11
Props/Controllers/ApiControllerBase.cs
Normal file
11
Props/Controllers/ApiControllerBase.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Props.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/[Controller]")]
|
||||||
|
public class ApiControllerBase : ControllerBase
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -4,9 +4,7 @@ using Props.Services.Modules;
|
|||||||
|
|
||||||
namespace Props.Controllers
|
namespace Props.Controllers
|
||||||
{
|
{
|
||||||
[ApiController]
|
public class SearchController : ApiControllerBase
|
||||||
[Route("api/[Controller]")]
|
|
||||||
public class SearchController : ControllerBase
|
|
||||||
{
|
{
|
||||||
private SearchOutline defaultOutline = new SearchOutline();
|
private SearchOutline defaultOutline = new SearchOutline();
|
||||||
IShopManager shopManager;
|
IShopManager shopManager;
|
||||||
@ -23,16 +21,15 @@ namespace Props.Controllers
|
|||||||
return Ok(shopManager.AvailableShops());
|
return Ok(shopManager.AvailableShops());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("Default/Outline/Filters")]
|
[Route("Default/Filters")]
|
||||||
public IActionResult GetDefaultFilters()
|
public IActionResult GetDefaultFilters()
|
||||||
{
|
{
|
||||||
return Ok(defaultOutline.Filters);
|
return Ok(defaultOutline.Filters);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("Default/Outline/DisabledShops")]
|
[Route("Default/DisabledShops")]
|
||||||
public IActionResult GetDefaultDisabledShops()
|
public IActionResult GetDefaultDisabledShops()
|
||||||
{
|
{
|
||||||
return Ok(defaultOutline.Disabled);
|
return Ok(defaultOutline.Disabled);
|
||||||
|
@ -19,7 +19,7 @@ let inputs = {
|
|||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
setupInteractiveBehavior();
|
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);
|
await setupShopToggles((await apiHttp.get("/Search/Shops/Available")).data);
|
||||||
|
|
||||||
document.querySelector("#configuration .invisible").classList.remove("invisible"); // Load completed, show the UI.
|
document.querySelector("#configuration .invisible").classList.remove("invisible"); // Load completed, show the UI.
|
||||||
@ -88,7 +88,7 @@ async function setupInitialValues(filters) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function setupShopToggles(availableShops) {
|
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");
|
let shopsElem = document.getElementById("shop-checkboxes");
|
||||||
availableShops.forEach(shopName => {
|
availableShops.forEach(shopName => {
|
||||||
let id = `${shopName}-enabled`;
|
let id = `${shopName}-enabled`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user