Add avaliableFields functionality to GlobalVariablesStore
This commit is contained in:
parent
366ce591cb
commit
8dac69708f
3 changed files with 11 additions and 0 deletions
|
|
@ -3,6 +3,13 @@ import { GlobalVariablesStore } from "../types/zustand/globalVariables";
|
||||||
|
|
||||||
export const useGlobalVariablesStore = create<GlobalVariablesStore>(
|
export const useGlobalVariablesStore = create<GlobalVariablesStore>(
|
||||||
(set, get) => ({
|
(set, get) => ({
|
||||||
|
avaliableFields: [],
|
||||||
|
setAvaliableFields: (fields) => {
|
||||||
|
set({ avaliableFields: fields });
|
||||||
|
},
|
||||||
|
addAvaliableField: (field) => {
|
||||||
|
set({ avaliableFields: [...get().avaliableFields, field] });
|
||||||
|
},
|
||||||
globalVariablesEntries: [],
|
globalVariablesEntries: [],
|
||||||
globalVariables: {},
|
globalVariables: {},
|
||||||
setGlobalVariables: (variables) => {
|
setGlobalVariables: (variables) => {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ export const useTypesStore = create<TypesStoreType>((set, get) => ({
|
||||||
templates: templatesGenerator(data),
|
templates: templatesGenerator(data),
|
||||||
}));
|
}));
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
console.log(templatesGenerator(data))
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,7 @@ export type GlobalVariablesStore = {
|
||||||
addGlobalVariable: (name: string, id: string, type?: string) => void;
|
addGlobalVariable: (name: string, id: string, type?: string) => void;
|
||||||
removeGlobalVariable: (name: string) => void;
|
removeGlobalVariable: (name: string) => void;
|
||||||
getVariableId: (name: string) => string | undefined;
|
getVariableId: (name: string) => string | undefined;
|
||||||
|
avaliableFields: Array<string>;
|
||||||
|
setAvaliableFields: (fields: Array<string>) => void;
|
||||||
|
addAvaliableField: (field: string) => void;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue