(fullName, requiredFields = [])
| 42 | // Fetches a single repository from Github API unless it is cached. |
| 43 | // Relies on Redux Thunk middleware. |
| 44 | export const loadRepo = (fullName, requiredFields = []) => (dispatch, getState) => { |
| 45 | const repo = getState().entities.repos[fullName] |
| 46 | if (repo && requiredFields.every(key => repo.hasOwnProperty(key))) { |
| 47 | return null |
| 48 | } |
| 49 | |
| 50 | return dispatch(fetchRepo(fullName)) |
| 51 | } |
| 52 | |
| 53 | export const STARRED_REQUEST = 'STARRED_REQUEST' |
| 54 | export const STARRED_SUCCESS = 'STARRED_SUCCESS' |