Skip to content

Commit

Permalink
chore: remove notAllowed
Browse files Browse the repository at this point in the history
  • Loading branch information
bigint committed Jul 9, 2024
1 parent f49e44e commit 5275cc4
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions apps/api/src/helpers/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,6 @@ import type { Response } from 'express';

import { Errors } from '@hey/data';

const getMessageByStatus = (status: number) => {
switch (status) {
case 400:
return Errors.InvalidBody;
case 401:
return Errors.Unauthorized;
case 500:
return Errors.SomethingWentWrong;
default:
return Errors.NotAllowed;
}
};

export const notAllowed = (response: Response, status?: number) => {
return response
.status(status || 401)
.json({ error: getMessageByStatus(status || 401), success: false });
};

export const invalidBody = (response: Response) => {
return response
.status(400)
Expand Down

0 comments on commit 5275cc4

Please sign in to comment.