refactor: added constant

This commit is contained in:
sundasnoreen12
2025-02-17 21:09:11 +05:00
parent e9aa787ade
commit 70cb1803b4
2 changed files with 7 additions and 1 deletions

View File

@@ -22,7 +22,12 @@ const SOCIAL = {
},
};
const FIELD_LABELS = {
COUNTRY: 'country',
};
export {
EDUCATION_LEVELS,
SOCIAL,
FIELD_LABELS,
};

View File

@@ -2,6 +2,7 @@ import { ensureConfig, getConfig } from '@edx/frontend-platform';
import { getAuthenticatedHttpClient as getHttpClient } from '@edx/frontend-platform/auth';
import { logError } from '@edx/frontend-platform/logging';
import { camelCaseObject, convertKeyNames, snakeCaseObject } from '../utils';
import { FIELD_LABELS } from './constants';
ensureConfig(['LMS_BASE_URL'], 'Profile API service');
@@ -150,7 +151,7 @@ export async function getCourseCertificates(username) {
function extractCountryList(data) {
return data?.fields
.find(({ name }) => name === 'country')
.find(({ name }) => name === FIELD_LABELS.COUNTRY)
?.options?.map(({ value, name }) => ({ code: value, name })) || [];
}