Added ShopPanel to home sidebar
• Added: - ShopPanel to home sidebar - DIssenter shop redux, api route/controller
This commit is contained in:
@@ -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,
|
||||
|
||||
41
app/javascript/gabsocial/reducers/shop.js
Normal file
41
app/javascript/gabsocial/reducers/shop.js
Normal 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user