Prevent certificate list API call failure from crashing page.
This commit is contained in:
committed by
Douglas Hall
parent
a1dc64ae33
commit
0e0ce562e4
@@ -5,6 +5,7 @@ import {
|
||||
convertKeyNames,
|
||||
snakeCaseObject,
|
||||
} from './utils';
|
||||
import LoggingService from '../services/LoggingService';
|
||||
|
||||
function processAccountData(data) {
|
||||
const result = camelCaseObject(data);
|
||||
@@ -130,7 +131,11 @@ function transformCertificateData(data) {
|
||||
|
||||
export async function getCourseCertificates(username) {
|
||||
const url = `${configuration.CERTIFICATES_API_BASE_URL}/${username}/`;
|
||||
const { data } = await apiClient.get(url);
|
||||
|
||||
return transformCertificateData(data);
|
||||
try {
|
||||
const { data } = await apiClient.get(url);
|
||||
return transformCertificateData(data);
|
||||
} catch (e) {
|
||||
LoggingService.logAPIErrorResponse(e);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user