Skip to content

Commit

Permalink
change my own last Pr to ncorporate new SetHeaders convention
Browse files Browse the repository at this point in the history
  • Loading branch information
quansenB committed Sep 18, 2019
1 parent 14bb0cf commit be64bab
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/utils/handlers/changeRequestHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import axios from 'axios';
import { toast } from 'react-toastify';
import { pathObj } from '../generalVariables';
import { setHeaders } from '../requestHeaders';
import { getToken } from './authenticationHandlers';

export const getAllChangeRequests = () => {
const token = getToken();
return axios
.get(`${pathObj.getEdits}`, setHeaders(token))
.get(`${pathObj.getEdits}`, setHeaders())
.then(res => {
if (res.data) {
return res.data.changeRequests;
Expand All @@ -19,13 +17,12 @@ export const getAllChangeRequests = () => {
};

export const getChangeRequestsById = requestId => {
const token = getToken();
if (!requestId || typeof requestId !== 'string') {
return new Error("Make sure you're passing an edit id!");
}

return axios
.get(`${pathObj.getEdits}/${requestId}`, setHeaders(token))
.get(`${pathObj.getEdits}/${requestId}`, setHeaders())
.then(res => {
if (res.data) {
return res.data;
Expand Down

0 comments on commit be64bab

Please sign in to comment.