Last active
September 9, 2016 03:01
-
-
Save yasuhiro-okada-aktsk/9e80741045c2757600fecde2bbc94c9d to your computer and use it in GitHub Desktop.
aktsk redux
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 {expect} from 'chai'; | |
import reducer from '../index' | |
describe('image_uploader reducer', () => { | |
describe('init', () => { | |
it('should initialize state', () => { | |
const action = {} | |
const result = { | |
} | |
return expect(reducer({}, action)).to.eql(result); | |
}); | |
}); | |
}); |
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 {CALL_API} from 'redux-api-middleware'; | |
// type | |
const GET = 'wowful/iamge_uploader/GET'; | |
const GET_SUCCESS = 'wowful/iamge_uploader/GET_SUCCESS'; | |
const GET_FAILURE = 'wowful/iamge_uploader/GET_FAILURE'; | |
// reducers | |
const images = (state = [], action) => { | |
switch (action.type) { | |
case GET_SUCCESS: | |
return action.payload; | |
default: | |
return state; | |
} | |
}; | |
export default images; | |
// actions | |
export const branchImagesGet = (branch_id, image_type) => { | |
return { | |
[CALL_API]: { | |
endpoint: `/api/host/branch/${branch_id}?image_type=${image_type}`, | |
method: 'GET', | |
types: [GET, GET_SUCCESS, GET_FAILURE] | |
} | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment