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.

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');
  };

apollo-server-micro

Production-ready Node.js GraphQL server for Micro

MIT
Latest version published 1 month ago

Package Health Score

92 / 100
Full package analysis

Similar packages