Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 3a6bbc0

Browse files
#668 - Remove redundant api call
1 parent d483352 commit 3a6bbc0

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

client/src/services/user-org.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const ORGANIZATIONID_KEY = "organizationId";
1010
*/
1111
export async function getOrg(apiClient, handle) {
1212
let response;
13-
let organizationIds = [];
1413
let organizations = [];
1514
let errorMessage =
1615
"An error occurred when getting the organization associated with your user";
@@ -56,22 +55,9 @@ export async function getOrg(apiClient, handle) {
5655
return;
5756
}
5857

59-
organizationIds = response.data.map((o) => o.organizationId);
60-
58+
organizations = response.data.map((o) => o.organization);
6159
// Get the org names
62-
for (let i = 0; i < organizationIds.length; i++) {
63-
url = `${config.API_URL}/organizations/${organizationIds[i]}`;
64-
65-
try {
66-
response = await apiClient.get(url);
67-
} catch (error) {
68-
console.log(error);
69-
alert(errorMessage);
70-
return;
71-
}
72-
73-
organizations.push(_.pick(response.data, ["id", "name"]));
74-
}
60+
organizations = organizations.map((o) => _.pick(o, ["id", "name"]));
7561

7662
return organizations;
7763
}

0 commit comments

Comments
 (0)