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,16 @@
// @ts-nocheck
import ApiService from '@/services/ApiService';
import t from '@/store/types';
export const fetchResourceFields = ({ resourceSlug }) => {
return (dispatch) => new Promise((resolve, reject) => {
ApiService.get(`fields/resource/${resourceSlug}`).then((response) => {
dispatch({
type: t.CUSTOM_FIELDS_RESOURCE_SET,
resourceSlug: resourceSlug,
fields: response.data.fields,
});
resolve(response);
}).catch(error => { reject(error); });
});
}

View File

@@ -0,0 +1,25 @@
// @ts-nocheck
import {createReducer} from '@reduxjs/toolkit';
import t from '@/store/types';
const initialState = {
custom_fields: {
accounts: [{
label_name: 'Label',
predefined: true,
data_type: 'text',
help_text: '123sdasd',
active: true,
}]
},
};
export default createReducer(initialState, {
[t.CUSTOM_FIELDS_RESOURCE_SET]: (state, action) => {
state.fields.custom_fields[action.resource_slug] = action.custom_field;
}
});
export const getCustomFieldsByResource = (state, resourceSlug) => {
return state.fields.custom_fields[resourceSlug];
}

View File

@@ -0,0 +1,5 @@
// @ts-nocheck
export default {
CUSTOM_FIELDS_RESOURCE_SET: 'CUSTOM_FIELDS_RESOURCE_SET',
};