Add access control (#65)
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { checkAccess } from '../cognito/access-control';
|
||||
import { CategoryAPI } from '../datasources/category-api';
|
||||
import { ProductAPI } from '../datasources/product-api';
|
||||
|
||||
const Category = {
|
||||
async products({ id }, _args, { dataSources }) {
|
||||
async products({ id }, _args, { dataSources, auth }) {
|
||||
checkAccess(['products.read'], auth);
|
||||
return (<ProductAPI>dataSources.productApi).getCategoryProducts(id);
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user