From 326a0f98660fdeed99afaa692a141225b8e9f9ea Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 8 Feb 2024 15:06:54 -0300 Subject: [PATCH] Refactor getGlobalVariables function to store data in globalVariables object --- src/frontend/src/controllers/API/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/controllers/API/index.ts b/src/frontend/src/controllers/API/index.ts index 7b960547c..176509867 100644 --- a/src/frontend/src/controllers/API/index.ts +++ b/src/frontend/src/controllers/API/index.ts @@ -854,7 +854,14 @@ export async function requestLogout() { export async function getGlobalVariables(): Promise<{ [key: string]: { id: string; provider: string }; }> { - return (await api.get(`${BASE_URL_API}credentials/`)).data; + const globalVariables = {}; + (await api.get(`${BASE_URL_API}credentials/`)).data.forEach((element) => { + globalVariables[element.name] = { + id: element.id, + provider: element.provider, + }; + }); + return globalVariables; } export async function registerGlobalVariable(