diff --git a/src/actions/index.js b/src/actions/index.js new file mode 100644 index 0000000..306218d --- /dev/null +++ b/src/actions/index.js @@ -0,0 +1,11 @@ +import github from '../apis/github'; + +export const getRepos = () => async (dispatch, getState) => { + const response = await github.get('/users/RaspberryProgramming/repos'); + //console.log(response); + + dispatch({ + type: 'GET_REPOS', + payload: response.data, + }); +}; \ No newline at end of file diff --git a/src/apis/github.js b/src/apis/github.js new file mode 100644 index 0000000..0004350 --- /dev/null +++ b/src/apis/github.js @@ -0,0 +1,5 @@ +import axios from 'axios'; + +export default axios.create({ + baseURL: 'https://api.github.com' +}); \ No newline at end of file diff --git a/src/index.js b/src/index.js index 1e9e8ff..05d9540 100644 --- a/src/index.js +++ b/src/index.js @@ -1,12 +1,18 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import './index.css'; -import App from './components/App'; +import { Provider } from 'react-redux'; +import { createStore, applyMiddleware, compose } from 'redux'; +import reduxThunk from 'redux-thunk'; +import App from './components/App'; +import reducers from './reducers'; + +const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; +const store = createStore(reducers, composeEnhancers(applyMiddleware(reduxThunk))); ReactDOM.render( -