MCPcopy Create free account
hub / github.com/Snowflyt/tinyeffect / requiresAdmin

Function requiresAdmin

test/README.example.proof.ts:22–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20 const authError = error("auth");
21
22 const requiresAdmin = () =>
23 effected(function* () {
24 const user = yield* askUser();
25 if (!user) return yield* authError("No user found");
26 if (user.role !== "admin") return yield* authError(`User ${user.name} is not an admin`);
27 });
28
29 const fetchAdminData = () =>
30 effected(function* () {

Callers 4

fetchAdminDataFunction · 0.70
createUserFunction · 0.70
createUser2Function · 0.70
createUser1Function · 0.70

Calls 1

effectedFunction · 0.90

Tested by

no test coverage detected