Commit f22c2e1c authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg Committed by Sébastiaan Versteeg
Browse files

Change event API urls

parent 6b7af0f9
......@@ -16,10 +16,6 @@ export function calendarNotRetrieved() {
export function retrieveCalendar(token) {
return (dispatch) => {
const start = new Date().toISOString().substring(0, 10);
let end = new Date();
end.setMonth(end.getMonth() + 6);
end = end.toISOString().substring(0, 10);
const data = {
method: 'GET',
headers: {
......@@ -28,13 +24,11 @@ export function retrieveCalendar(token) {
Authorization: `Token ${token}`,
},
};
return fetch(`${url}/api/events/eventlist/?start=${start}&end=${end}`, data)
return fetch(`${url}/api/events/`, data)
.then(
response => response.json())
.then(
responseJson => dispatch(calendarRetrieved(responseJson)))
.catch(() => {
dispatch(calendarNotRetrieved());
});
.catch(() => dispatch(calendarNotRetrieved()));
};
}
......@@ -25,7 +25,7 @@ export function loadEvent(id, token) {
Authorization: `Token ${token}`,
},
};
return fetch(`${url}/api/events/data/?event_id=${id}`, data)
return fetch(`${url}/api/events/${id}/`, data)
.then(
response => response.json(),
)
......
......@@ -34,12 +34,12 @@ const Calendar = (props) => {
Calendar.propTypes = {
eventList: React.PropTypes.arrayOf(React.PropTypes.shape({
pk: React.PropTypes.number,
title: React.PropTypes.string,
description: React.PropTypes.string,
start: React.PropTypes.string,
location: React.PropTypes.string,
price: React.PropTypes.string,
id: React.PropTypes.number,
price: React.PropTypes.string
})).isRequired,
calendarFetched: React.PropTypes.bool.isRequired,
retrieveCalendar: React.PropTypes.func.isRequired,
......
......@@ -21,6 +21,7 @@ const Event = (props) => {
Event.propTypes = {
data: React.PropTypes.shape({
pk: React.PropTypes.number.isRequired,
title: React.PropTypes.string.isRequired,
description: React.PropTypes.string.isRequired,
start: React.PropTypes.string.isRequired,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment