From 8292cb8cfa635cc3943202af33e3bacc5f05a8d2 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 25 Mar 2024 09:59:10 -0300 Subject: [PATCH] Update global variable type in API and store --- src/frontend/src/controllers/API/index.ts | 12 ++++++------ src/frontend/src/stores/globalVariables.ts | 4 ++-- .../src/types/zustand/globalVariables/index.ts | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/frontend/src/controllers/API/index.ts b/src/frontend/src/controllers/API/index.ts index 3c2425f58..52082abd9 100644 --- a/src/frontend/src/controllers/API/index.ts +++ b/src/frontend/src/controllers/API/index.ts @@ -860,13 +860,13 @@ export async function requestLogout() { } export async function getGlobalVariables(): Promise<{ - [key: string]: { id: string; provider: string }; + [key: string]: { id: string; type: string }; }> { const globalVariables = {}; (await api.get(`${BASE_URL_API}variables/`)).data.forEach((element) => { globalVariables[element.name] = { id: element.id, - provider: element.provider, + type: element.type, }; }); return globalVariables; @@ -875,16 +875,16 @@ export async function getGlobalVariables(): Promise<{ export async function registerGlobalVariable({ name, value, - provider, + type, }: { name: string; value: string; - provider?: string; -}): Promise> { + type?: string; +}): Promise> { return await api.post(`${BASE_URL_API}variables/`, { name, value, - provider, + type, }); } diff --git a/src/frontend/src/stores/globalVariables.ts b/src/frontend/src/stores/globalVariables.ts index e3b8cc734..e2f3e37df 100644 --- a/src/frontend/src/stores/globalVariables.ts +++ b/src/frontend/src/stores/globalVariables.ts @@ -11,8 +11,8 @@ export const useGlobalVariablesStore = create( globalVariablesEntries: Object.keys(variables), }); }, - addGlobalVariable: (name, id, provider) => { - const data = { id, provider }; + addGlobalVariable: (name, id, type) => { + const data = { id, type }; const newVariables = { ...get().globalVariables, [name]: data }; set({ globalVariables: newVariables, diff --git a/src/frontend/src/types/zustand/globalVariables/index.ts b/src/frontend/src/types/zustand/globalVariables/index.ts index e50e85ba4..3e651179e 100644 --- a/src/frontend/src/types/zustand/globalVariables/index.ts +++ b/src/frontend/src/types/zustand/globalVariables/index.ts @@ -1,10 +1,10 @@ export type GlobalVariablesStore = { globalVariablesEntries: Array; - globalVariables: { [name: string]: { id: string; provider?: string } }; + globalVariables: { [name: string]: { id: string; type?: string } }; setGlobalVariables: (variables: { - [name: string]: { id: string; provider?: string }; + [name: string]: { id: string; type?: string }; }) => void; - addGlobalVariable: (name: string, id: string, provider?: string) => void; + addGlobalVariable: (name: string, id: string, type?: string) => void; removeGlobalVariable: (name: string) => void; getVariableId: (name: string) => string | undefined; };