Skip to content
This repository has been archived by the owner on Nov 8, 2018. It is now read-only.

Commit

Permalink
Merge pull request #190 from redbadger/rest-events
Browse files Browse the repository at this point in the history
REST’arised events URL
  • Loading branch information
asavin authored Jul 13, 2016
2 parents 3c4f45e + 95d53db commit 1f4a6bb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/server/api/controllers/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default class EventsController {
getEvent = (req, res) => {
const body = `
query {
event(id: "${req.query.id}") {
event(id: "${req.params.id}") {
${allEventFields}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function createApi(workable) {
api.use(bodyParser.urlencoded({ extended: true }));

api.get('/jobs', jobsController.getJobs);
api.get('/event', eventsController.getEvent);
api.get('/event/:id', eventsController.getEvent);
api.get('/events', eventsController.getEvents);

return api;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/actions/events/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const fetchEvent = (fetch) => (
const { id, token } = location ? location.query : {};

if (id && token) {
return fetch(`${apiEndpoint}/event?id=${id}&token=${token}`)
return fetch(`${apiEndpoint}/event/${id}?token=${token}`)
// eslint-disable-next-line no-shadow
.then((event) => dispatch(fetchSuccessful(event)))
.catch((error) => dispatch(fetchFailure(error)));
Expand Down
2 changes: 1 addition & 1 deletion src/shared/actions/events/event.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('event actions', () => {
fetchFn(dispatch, getState, nextState)
.then(() => {
const { id, token } = nextState.location.query;
expect(fetch.firstCall.args[0]).to.equal(`${apiEndpoint}/event?id=${id}&token=${token}`);
expect(fetch.firstCall.args[0]).to.equal(`${apiEndpoint}/event/${id}?token=${token}`);
done();
})
.catch(done);
Expand Down

0 comments on commit 1f4a6bb

Please sign in to comment.