Skip to content

Commit

Permalink
refactor(store): move footer logic into modules
Browse files Browse the repository at this point in the history
  • Loading branch information
aneurysmjs committed Aug 29, 2019
1 parent 6069882 commit ac0bbe5
Show file tree
Hide file tree
Showing 19 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/app/components/core/Footer/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
// $FlowIgnore
import { useSelector } from 'react-redux';

import { getFooter } from '@/store/reducers/footer';
import { getFooter } from '@/store/modules/footer/selectors';
import type { FooterType } from '@/store/types/FooterType';

import Icon from '@/components/base/Icon/Icon';
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions src/app/store/helpers/createReducer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// @flow strict
// eslint-disable-next-line import/prefer-default-export
export { default as createReducer } from './createReducer';
3 changes: 3 additions & 0 deletions src/app/store/helpers/makeActionCreator/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// @flow strict
// eslint-disable-next-line import/prefer-default-export
export { default as makeActionCreator } from './makeActionCreator';
File renamed without changes.
2 changes: 1 addition & 1 deletion src/app/store/modules/cart/actions/cartAction.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow strict
import * as types from '@/store/ActionTypes';

import makeActionCreator from '@/store/actions/makeActionCreator';
import { makeActionCreator } from '@/store/helpers/makeActionCreator';

export default makeActionCreator(types.CART_DATA, 'cart');
2 changes: 1 addition & 1 deletion src/app/store/modules/cart/reducers/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { CartType, CartActionType } from '@/store/types/CartType';

import { CART_DATA } from '@/store/ActionTypes';

import createReducer from '@/store/reducers/createReducer';
import { createReducer } from '@/store/helpers/createReducer';

const initialState = {
quantity: 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow strict
import * as types from '@/store/ActionTypes';

import makeActionCreator from '@/store/actions/makeActionCreator';
import { makeActionCreator } from '@/store/helpers/makeActionCreator';

export default makeActionCreator(types.FOOTER_DATA, 'footer');
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import type { FooterType, FooterActionType } from '@/store/types/FooterType';

import { FOOTER_DATA } from '@/store/ActionTypes';
import type { State } from '@/store/types/State';

import createReducer from '../createReducer';
import { createReducer } from '@/store/helpers/createReducer';

const initialState = {
social: [
Expand All @@ -20,5 +19,3 @@ export default createReducer<FooterType, FooterActionType>(initialState, {
};
},
});

export const getFooter = ({ footer }: State) => footer;
3 changes: 3 additions & 0 deletions src/app/store/modules/footer/reducers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// @flow strict
// eslint-disable-next-line import/prefer-default-export
export { default as footer } from './footer';
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
// @flow strict

import type { State } from '@/store/types/State';

import footer from './footer';

export default footer;

// eslint-disable-next-line import/prefer-default-export
export const getFooter = (state: State) => state.footer;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// @flow strict
// eslint-disable-next-line import/prefer-default-export
export { footerData } from './footerData';
export { getFooter } from './getFooter';
2 changes: 1 addition & 1 deletion src/app/store/modules/products/reducers/products.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow strict
import type { ProductsType, ProductActionType } from '@/store/types/ProductsType';

import createReducer from '@/store/reducers/createReducer';
import { createReducer } from '@/store/helpers/createReducer';

import {
GET_PRODUCTS_FAILURE,
Expand Down
2 changes: 1 addition & 1 deletion src/app/store/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { combineReducers } from 'redux';

import type { Actions } from '@/store/types/Actions';

import footer from './footer';
import { footer } from '@/store/modules/footer/reducers';
import { cart } from '@/store/modules/cart/reducers';
import { products } from '@/store/modules/products/reducers';

Expand Down

0 comments on commit ac0bbe5

Please sign in to comment.