Created
April 14, 2016 09:01
-
-
Save lesniakania/31b9789a7a8d9880338362e9208d8300 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ActionTypes from '../constants/ActionTypes'; | |
import Connection from '../lib/Connection'; | |
const _requestSubmissionsList = (submissionType) => { | |
return { | |
type: ActionTypes.REQUEST_SUBMISSIONS_LIST, | |
submission_type: submissionType | |
}; | |
} | |
const _receiveSubmissionsList = (submissions) => { | |
return { | |
type: ActionTypes.RECEIVE_SUBMISSIONS_LIST, | |
submissions: submissions | |
}; | |
} | |
const _fetchSubmissionsList = (submissionType) => { | |
return (dispatch) => { | |
dispatch(_requestSubmissionsList(submissionType)); | |
return Connection.get(`/submissions/${submissionType}`) | |
.then((response) => { | |
dispatch(_receiveSubmissionsList(response.data)) | |
}); | |
}; | |
} | |
export const fetchSubmissionsList = _fetchSubmissionsList; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment