outOfStockReducer.js
796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'use strict';
/**
* ## Imports
*
* InitialState
*/
import InitialState from './outOfStockInitialState';
import Immutable, {List, Record} from 'immutable';
const {
STOCKOUT_REQUEST,
STOCKOUT_SUCCESS,
STOCKOUT_FAILURE,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
/**
* ## guideReducer function
* @param {Object} state - initialState
* @param {Object} action - type and payload
*/
export default function userReducer(state = initialState, action) {
if (!(state instanceof InitialState)) return initialState.merge(state);
switch (action.type) {
case STOCKOUT_REQUEST:{
return state;
}
case STOCKOUT_SUCCESS:{
return state;
}
case STOCKOUT_FAILURE:{
return state;
}
return state;
}
return state;
}