Skip to content

Instantly share code, notes, and snippets.

@yasuhiro-okada-aktsk
Last active September 9, 2016 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yasuhiro-okada-aktsk/9e80741045c2757600fecde2bbc94c9d to your computer and use it in GitHub Desktop.
Save yasuhiro-okada-aktsk/9e80741045c2757600fecde2bbc94c9d to your computer and use it in GitHub Desktop.
aktsk redux
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);
});
});
});
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