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

Commit 9be1a6a

Browse files
#627 - For when the skill does not come from EMSI, the skill id is the external id. So we verify for its existence through skill id too once before deciding to create it agian
1 parent d4940f0 commit 9be1a6a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

client/src/components/ProfileCard/helper.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { getSingleOrg } from "../../services/user-org";
1010
* @param {String} skillExternalId The skill external id
1111
*/
1212
async function checkIfSkillExists(apiClient, skillProviderId, skillExternalId) {
13-
const url = `${config.API_URL}/skills?skillProviderId=${skillProviderId}&externalId=${skillExternalId}`;
13+
let url = `${config.API_URL}/skills?skillProviderId=${skillProviderId}&externalId=${skillExternalId}`;
1414
let response = {};
1515

1616
try {
@@ -24,6 +24,20 @@ async function checkIfSkillExists(apiClient, skillProviderId, skillExternalId) {
2424
return response.data;
2525
}
2626

27+
// The external id of the skill could also be its id field - try querying for it instead
28+
url = `${config.API_URL}/skills?skillProviderId=${skillProviderId}&skillId=${skillExternalId}`;
29+
30+
try {
31+
response = await apiClient.get(url);
32+
} catch (error) {
33+
console.log(error);
34+
// TODO - handle error
35+
}
36+
37+
if (response.data) {
38+
return response.data;
39+
}
40+
2741
return null;
2842
}
2943

0 commit comments

Comments
 (0)