Skip to content
Permalink
3e01d3391a
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
31 lines (27 sloc) 801 Bytes
export async function onRequestPost(context: RequestContext) {
const { active } = context.data.body;
const { permissions } = context.data.current_user;
console.log(permissions)
if (!(permissions & (1 << 0)) && !(permissions & (1 << 11)))
return new Response('{"error":"Forbidden"}', {
headers: {
"content-type": "application/json",
},
status: 403,
});
if (typeof active !== "boolean")
return new Response('{"error":"Active property must be a boolean"}', {
headers: {
"content-type": "application/json",
},
status: 400,
});
if (active) {
await context.env.DATA.delete("appeal_disabled");
} else {
await context.env.DATA.put("appeal_disabled", "1");
}
return new Response(null, {
status: 204,
});
}