Refactor getGlobalVariables function to store data in globalVariables object

This commit is contained in:
anovazzi1 2024-02-08 15:06:54 -03:00
commit 326a0f9866

View file

@ -854,7 +854,14 @@ export async function requestLogout() {
export async function getGlobalVariables(): Promise<{ export async function getGlobalVariables(): Promise<{
[key: string]: { id: string; provider: string }; [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( export async function registerGlobalVariable(