// Fetches a single repository from Github API. // Relies on the custom API middleware defined in ../middleware/api.js. const fetchRepo = fullName => ({ [CALL_API]: { types: [ REPO_REQUEST, REPO_SUCCESS, REPO_FAILURE ], endpoint: `repos/${fullName}`, schema: Schemas.REPO } })
// Fetches a single user from Github API. // Relies on the custom API middleware defined in ../middleware/api.js. const fetchUser = login => ({ [CALL_API]: { types: [ USER_REQUEST, USER_SUCCESS, USER_FAILURE ], endpoint: `users/${login}`, schema: Schemas.USER } })
function normalizeCards(cardsData) { const cards = { cards: cardsData }; const card = new schema.Entity('cards'); return normalize(cards, { cards: [card] }).entities.cards }
const genericSchema = type => new schema.Entity(type.toLowerCase(), {}, { idAttribute: '_id' })
// Fetches a single repository from Github API. // Relies on the custom API middleware defined in ../middleware/api.js. const fetchRepo = fullName => ({ [CALL_API]: { types: [ REPO_REQUEST, REPO_SUCCESS, REPO_FAILURE ], endpoint: `repos/${fullName}`, schema: Schemas.REPO } })
// Fetches a single user from Github API. // Relies on the custom API middleware defined in ../middleware/api.js. const fetchUser = login => ({ [CALL_API]: { types: [ USER_REQUEST, USER_SUCCESS, USER_FAILURE ], endpoint: `users/${login}`, schema: Schemas.USER } })
// Fetches a single repository from Github API. // Relies on the custom API middleware defined in ../middleware/api.js. const fetchRepo = fullName => ({ [CALL_API]: { types: [ REPO_REQUEST, REPO_SUCCESS, REPO_FAILURE ], endpoint: `repos/${fullName}`, schema: Schemas.REPO } })
// Fetches a single user from Github API. // Relies on the custom API middleware defined in ../middleware/api.js. const fetchUser = login => ({ [CALL_API]: { types: [ USER_REQUEST, USER_SUCCESS, USER_FAILURE ], endpoint: `users/${login}`, schema: Schemas.USER } })