Skip to content

Commit 70cb180

Browse files
refactor: added constant
1 parent e9aa787 commit 70cb180

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/profile/data/constants.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ const SOCIAL = {
2222
},
2323
};
2424

25+
const FIELD_LABELS = {
26+
COUNTRY: 'country',
27+
};
28+
2529
export {
2630
EDUCATION_LEVELS,
2731
SOCIAL,
32+
FIELD_LABELS,
2833
};

src/profile/data/services.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ensureConfig, getConfig } from '@edx/frontend-platform';
22
import { getAuthenticatedHttpClient as getHttpClient } from '@edx/frontend-platform/auth';
33
import { logError } from '@edx/frontend-platform/logging';
44
import { camelCaseObject, convertKeyNames, snakeCaseObject } from '../utils';
5+
import { FIELD_LABELS } from './constants';
56

67
ensureConfig(['LMS_BASE_URL'], 'Profile API service');
78

@@ -150,7 +151,7 @@ export async function getCourseCertificates(username) {
150151

151152
function extractCountryList(data) {
152153
return data?.fields
153-
.find(({ name }) => name === 'country')
154+
.find(({ name }) => name === FIELD_LABELS.COUNTRY)
154155
?.options?.map(({ value, name }) => ({ code: value, name })) || [];
155156
}
156157

0 commit comments

Comments
 (0)