Added ShopPanel to home sidebar

• Added:
- ShopPanel to home sidebar
- DIssenter shop redux, api route/controller
This commit is contained in:
mgabdev
2020-07-01 21:33:10 -04:00
parent 0ca346b169
commit 095e646661
7 changed files with 228 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ import relationships from './relationships'
import reports from './reports'
import search from './search'
import settings from './settings'
import shop from './shop'
import sidebar from './sidebar'
import statuses from './statuses'
import status_lists from './status_lists'
@@ -69,6 +70,7 @@ const reducers = {
reports,
search,
settings,
shop,
sidebar,
statuses,
status_lists,

View File

@@ -0,0 +1,41 @@
import {
SHOP_FEATURED_PRODUCTS_FETCH_REQUEST,
SHOP_FEATURED_PRODUCTS_FETCH_SUCCESS,
SHOP_FEATURED_PRODUCTS_FETCH_FAIL,
} from '../actions/shop'
import {
Map as ImmutableMap,
List as ImmutableList,
fromJS,
} from 'immutable'
const initialState = ImmutableMap({
featured: ImmutableMap({
items: ImmutableList(),
isError: false,
isLoading: false,
}),
})
export default function suggestionsReducer(state = initialState, action) {
switch(action.type) {
case SHOP_FEATURED_PRODUCTS_FETCH_REQUEST:
return state.withMutations((map) => {
map.setIn([action.listType, 'isError'], false)
map.setIn([action.listType, 'isLoading'], true)
})
case SHOP_FEATURED_PRODUCTS_FETCH_SUCCESS:
return state.withMutations((map) => {
map.setIn([action.listType, 'items'], action.items)
map.setIn([action.listType, 'isError'], false)
map.setIn([action.listType, 'isLoading'], false)
})
case SHOP_FEATURED_PRODUCTS_FETCH_FAIL:
return state.withMutations((map) => {
map.setIn([action.listType, 'isError'], true)
map.setIn([action.listType, 'isLoading'], false)
})
default:
return state
}
}