mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-17 18:09:09 +00:00
miniflare init
This commit is contained in:
parent
8c07ed3123
commit
688954a2e0
52 changed files with 898 additions and 25 deletions
25
packages/api/old-src/utils/responses.ts
Normal file
25
packages/api/old-src/utils/responses.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { respond } from '@roleypoly/worker-utils';
|
||||
|
||||
export const ok = () => respond({ ok: true });
|
||||
|
||||
export const missingParameters = () =>
|
||||
respond({ error: 'missing parameters' }, { status: 400 });
|
||||
|
||||
export const lowPermissions = () =>
|
||||
respond({ error: 'no permissions for this action' }, { status: 403 });
|
||||
|
||||
export const accessControlViolation = () =>
|
||||
respond({ error: 'member fails access control requirements' }, { status: 403 });
|
||||
|
||||
export const notFound = () => respond({ error: 'not found' }, { status: 404 });
|
||||
|
||||
export const conflict = () => respond({ error: 'conflict' }, { status: 409 });
|
||||
|
||||
export const rateLimited = () =>
|
||||
respond({ error: 'rate limit hit, enhance your calm' }, { status: 429 });
|
||||
|
||||
export const invalid = (obj: any = {}) =>
|
||||
respond({ err: 'client sent something invalid', data: obj }, { status: 400 });
|
||||
|
||||
export const notAuthenticated = () =>
|
||||
respond({ err: 'not authenticated' }, { status: 403 });
|
Loading…
Add table
Add a link
Reference in a new issue