From c1d9e12956bf5d5f0ac59b75c61a8bbd74349646 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Mon, 5 Feb 2024 14:45:47 -0300 Subject: [PATCH] Add global variables store using Zustand --- src/frontend/src/stores/globalVariables.ts | 9 +++++++++ src/frontend/src/types/zustand/globalVariables/index.ts | 4 ++++ 2 files changed, 13 insertions(+) create mode 100644 src/frontend/src/stores/globalVariables.ts create mode 100644 src/frontend/src/types/zustand/globalVariables/index.ts diff --git a/src/frontend/src/stores/globalVariables.ts b/src/frontend/src/stores/globalVariables.ts new file mode 100644 index 000000000..69a72f677 --- /dev/null +++ b/src/frontend/src/stores/globalVariables.ts @@ -0,0 +1,9 @@ +import { create } from "zustand"; +import { GlobalVariablesStore } from "../types/zustand/globalVariables"; + +const useGlobalVariablesStore = create((set, get) => ({ + globalVariables: [], + setGlobalVariables: (variables) => { + set({ globalVariables: variables }); + }, +})); diff --git a/src/frontend/src/types/zustand/globalVariables/index.ts b/src/frontend/src/types/zustand/globalVariables/index.ts new file mode 100644 index 000000000..51f45a85c --- /dev/null +++ b/src/frontend/src/types/zustand/globalVariables/index.ts @@ -0,0 +1,4 @@ +export type GlobalVariablesStore = { + globalVariables: Array; + setGlobalVariables: (variables: Array) => void; +};