diff --git a/src/account-settings/coaching/data/service.js b/src/account-settings/coaching/data/service.js index 8eba797..788da9b 100644 --- a/src/account-settings/coaching/data/service.js +++ b/src/account-settings/coaching/data/service.js @@ -8,8 +8,20 @@ import get from 'lodash.get'; * @param {Number} userId users are identified in the api by LMS id */ export async function getCoachingPreferences(userId) { - const { data } = await getAuthenticatedHttpClient() - .get(`${getConfig().LMS_BASE_URL}/api/coaching/v1/users/${userId}/`); + let data = {}; + try { + data = await getAuthenticatedHttpClient() + .get(`${getConfig().LMS_BASE_URL}/api/coaching/v1/users/${userId}/`); + } catch (error) { + // If a user isn't active the API call will fail with a lack of credentials. + data = { + coaching_consent: false, + user: userId, + eligible_for_coaching: false, + consent_form_seen: false, + }; + } + return data; }