Skip to content

Commit

Permalink
Improved methods and status codes (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
vanodevium authored and boyney123 committed May 21, 2019
1 parent 2f9a762 commit 4dc6b43
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
16 changes: 14 additions & 2 deletions client/src/components/RouteModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@ import { HttpMethods, StatusCodes } from "../../utils/consts";
import { updateRoute as updateRouteRequest, createNewRoute } from "../../utils/routes-api";
import faker from "faker";

const HTTP_METHOD_LIST = [HttpMethods.GET, HttpMethods.POST, HttpMethods.PUT, HttpMethods.DELETE];
const STATUS_CODES = [StatusCodes.OK, StatusCodes.CREATED, StatusCodes.NO_CONTENT, StatusCodes.BAD_REQUEST, StatusCodes.FORBIDDEN, StatusCodes.INTERNAL_SERVER_ERROR];
const HTTP_METHOD_LIST = [HttpMethods.GET, HttpMethods.POST, HttpMethods.PUT, HttpMethods.PATCH, HttpMethods.DELETE];
const STATUS_CODES = [
StatusCodes.OK,
StatusCodes.CREATED,
StatusCodes.ACCEPTED,
StatusCodes.NO_CONTENT,
StatusCodes.BAD_REQUEST,
StatusCodes.UNAUTHORIZED,
StatusCodes.FORBIDDEN,
StatusCodes.NOT_FOUND,
StatusCodes.CONFLICT,
StatusCodes.UNPROCESSABLE_ENTITY,
StatusCodes.INTERNAL_SERVER_ERROR
];

const Modal = function(props) {
const { onClose = () => {}, route: editedRoute } = props;
Expand Down
8 changes: 7 additions & 1 deletion client/src/utils/consts/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
export const HttpMethods = {
GET: "GET",
PUT: "PUT",
PATCH: "PATCH",
POST: "POST",
DELETE: "DELETE"
};

export const StatusCodes = {
OK: "200",
CREATED: "201",
ACCEPTED: "202",
NO_CONTENT: "204",
BAD_REQUEST: "400",
FORBIDDEN: "401",
UNAUTHORIZED: "401",
FORBIDDEN: "403",
NOT_FOUND: "404",
CONFLICT: "409",
UNPROCESSABLE_ENTITY: "422",
INTERNAL_SERVER_ERROR: "500"
};

Expand Down

0 comments on commit 4dc6b43

Please sign in to comment.