How to use the apollo-server-micro.ForbiddenError function in apollo-server-micro

To help you get started, we’ve selected a few apollo-server-micro examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github este / este / packages / api / models / createPermissions.ts View on Github external
const isWebCreatorOrAdmin = (web: NexusGenAllTypes['Web']) => {
    const viewer = isAuthenticated();
    // TODO: if (viewer.isAdmin) return;
    if (viewer.id === web.creator.id) return;
    throw new ForbiddenError('you must be web creator or admin');
  };