re: require authorization for items list
This commit is contained in:
@@ -15,13 +15,13 @@ public class ItemsController : ControllerBase {
|
|||||||
service_ = service;
|
service_ = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[Authorize]]
|
[Authorize]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<ActionResult<List<Item>>> getItems() {
|
public async Task<ActionResult<List<Item>>> getItems() {
|
||||||
return Ok(await service_.GetAll());
|
return Ok(await service_.GetAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
[[Authorize]]
|
[Authorize]
|
||||||
[HttpGet("{id:int}")]
|
[HttpGet("{id:int}")]
|
||||||
public async Task<ActionResult<Item>> getItem(int id) {
|
public async Task<ActionResult<Item>> getItem(int id) {
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const routes = [
|
|||||||
{ path: "/", component: index },
|
{ path: "/", component: index },
|
||||||
{ path: "/login", component: LoginForm },
|
{ path: "/login", component: LoginForm },
|
||||||
{ path: "/register", component: RegisterForm },
|
{ path: "/register", component: RegisterForm },
|
||||||
{ path: "/items", component: ItemsList },
|
{ path: "/items", component: ItemsList, meta: { requiresAuth: true } },
|
||||||
{ path: "/item/new", component: ItemForm, meta: { requiresAuth: true } },
|
{ path: "/item/new", component: ItemForm, meta: { requiresAuth: true } },
|
||||||
{ path: "/item/:id", component: ItemForm, meta: { requiresAuth: true } }
|
{ path: "/item/:id", component: ItemForm, meta: { requiresAuth: true } }
|
||||||
]; // I really like this
|
]; // I really like this
|
||||||
|
|||||||
Reference in New Issue
Block a user