re-structure to monorepo.

This commit is contained in:
a.bouhuolia
2023-02-03 01:02:31 +02:00
parent 8242ec64ba
commit 7a0a13f9d5
10400 changed files with 46966 additions and 17223 deletions

View File

@@ -0,0 +1,56 @@
// @ts-nocheck
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,
result,
};
}
export function universalSearchSetResourceType(resourceType) {
return {
type: t.UNIVERSAL_SEARCH_SET_RESOURCE_TYPE,
payload: {
resourceType,
},
};
}
export function universalSearchResetResourceType() {
return {
type: t.UNIVERSAL_SEARCH_RESET_RESOURCE_TYPE,
};
}
export function universalSearchSetSelectedItem(resourceType, resourceId) {
return {
type: t.UNIVERSAL_SEARCH_SET_ITEM_SELECT,
payload: {
resourceType,
resourceId
}
};
}
export function universalSearchResetSelectedItem() {
return {
type: t.UNIVERSAL_SEARCH_RESET_ITEM_SELECT,
payload: {}
};
}

View File

@@ -0,0 +1,40 @@
// @ts-nocheck
import t from '@/store/types';
import { createReducer } from '@reduxjs/toolkit';
const DEFAULT_RESOURCE_TYPE = 'customer';
const initialState = {
isOpen: false,
defaultResourceType: DEFAULT_RESOURCE_TYPE,
selectedItem: {},
};
export default createReducer(initialState, {
[t.OPEN_SEARCH]: (state, action) => {
state.isOpen = true;
},
[t.CLOSE_SEARCH]: (state, action) => {
state.isOpen = false;
},
[t.UNIVERSAL_SEARCH_SET_RESOURCE_TYPE]: (state, action) => {
state.defaultResourceType = action.payload.resourceType;
},
[t.UNIVERSAL_SEARCH_RESET_RESOURCE_TYPE]: (state, action) => {
state.defaultResourceType = DEFAULT_RESOURCE_TYPE;
},
[t.UNIVERSAL_SEARCH_SET_ITEM_SELECT]: (state, action) => {
state.selectedItem = {
resourceId: action.payload.resourceId,
resourceType: action.payload.resourceType,
};
},
[t.UNIVERSAL_SEARCH_RESET_ITEM_SELECT]: (state, action) => {
state.selectedItem = {};
},
});

View File

@@ -0,0 +1,10 @@
// @ts-nocheck
export default {
SEARCH_TYPE: 'SEARCH_TYPE',
OPEN_SEARCH: 'OPEN_SEARCH',
CLOSE_SEARCH: 'CLOSE_SEARCH',
UNIVERSAL_SEARCH_SET_RESOURCE_TYPE: 'UNIVERSAL_SEARCH_SET_RESOURCE_TYPE',
UNIVERSAL_SEARCH_RESET_RESOURCE_TYPE: 'UNIVERSAL_SEARCH_RESET_RESOURCE_TYPE',
UNIVERSAL_SEARCH_SET_ITEM_SELECT: 'UNIVERSAL_SEARCH_SET_ITEM_SELECT',
UNIVERSAL_SEARCH_RESET_ITEM_SELECT: 'UNIVERSAL_SEARCH_RESET_ITEM_SELECT'
};