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