mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
Merge global search.
This commit is contained in:
@@ -14,7 +14,7 @@ import financialStatements from './financialStatement/financialStatements.reduce
|
||||
import itemCategories from './itemCategories/itemsCategory.reducer';
|
||||
import settings from './settings/settings.reducer';
|
||||
import manualJournals from './manualJournals/manualJournals.reducers';
|
||||
import search from './search/search.reducer';
|
||||
import globalSearch from './search/search.reducer';
|
||||
|
||||
export default combineReducers({
|
||||
authentication,
|
||||
@@ -31,5 +31,5 @@ export default combineReducers({
|
||||
items,
|
||||
itemCategories,
|
||||
settings,
|
||||
search,
|
||||
globalSearch,
|
||||
});
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
import t from 'store/types';
|
||||
|
||||
export function openSearch(result) {
|
||||
return {
|
||||
type: t.OPEN_SEARCH,
|
||||
result,
|
||||
};
|
||||
}
|
||||
|
||||
export function closeSearch(result) {
|
||||
return {
|
||||
type: t.ClOSE_SEARCH,
|
||||
result,
|
||||
};
|
||||
}
|
||||
|
||||
export function generalSearch(name, result) {
|
||||
return {
|
||||
type: t.SEARCH_SUCCESS,
|
||||
|
||||
@@ -8,26 +8,11 @@ const initialState = {
|
||||
};
|
||||
|
||||
export default createReducer(initialState, {
|
||||
[t.SEARCH_SUCCESS]: (state, action) => {
|
||||
const _result = {};
|
||||
|
||||
action.searches.forEach((search) => {
|
||||
_result[search.id] = search;
|
||||
});
|
||||
|
||||
state.searches = {
|
||||
...state.searches,
|
||||
..._result,
|
||||
};
|
||||
[t.OPEN_SEARCH]: (state, action) => {
|
||||
state.isOpen = true;
|
||||
},
|
||||
});
|
||||
|
||||
// return state = action.result;
|
||||
// if (typeof state === 'undefined') {
|
||||
// return initialState;
|
||||
// }
|
||||
|
||||
// state.search[action.name] = {
|
||||
// isOpen: true,
|
||||
// payload: action.payload || {},
|
||||
// };
|
||||
[t.CLOSE_SEARCH]: (state, action) => {
|
||||
state.isOpen = false;
|
||||
}
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
export default {
|
||||
SEARCH_SUCCESS: 'SEARCH_SUCCESS',
|
||||
SEARCH_FAILURE: 'SEARCH_FAILURE',
|
||||
SEARCH_REQUEST: 'SEARCH_REQUEST',
|
||||
SEARCH_SUCCESS:'SEARCH_SUCCESS',
|
||||
OPEN_SEARCH: 'OPEN_SEARCH',
|
||||
CLOSE_SEARCH: 'CLOSE_SEARCH',
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@ import financialStatements from './financialStatement/financialStatements.types'
|
||||
import itemCategories from './itemCategories/itemsCategory.type';
|
||||
import settings from './settings/settings.type';
|
||||
import search from './search/search.type';
|
||||
|
||||
export default {
|
||||
...authentication,
|
||||
...accounts,
|
||||
|
||||
Reference in New Issue
Block a user