Skip to content

Commit

Permalink
fixup! feat: Adding human readable 403 error access restricted
Browse files Browse the repository at this point in the history
  • Loading branch information
farhaanbukhsh committed Dec 27, 2024
1 parent e8b4894 commit 0d905f9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/course-outline/page-alerts/PageAlerts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,11 @@ const PageAlerts = ({
let errorList = Object.entries(errors).filter(obj => obj[1] !== null).map(([k, v]) => {
switch (v.type) {
case API_ERROR_TYPES.serverError: {
let description = v.data || intl.formatMessage(messages.serverErrorAlertBody);
let description = (
<Truncate>
{v.data || intl.formatMessage(messages.serverErrorAlertBody)}
</Truncate>
);
let alertTitle = intl.formatMessage(messages.serverErrorAlert);
if (v.status === 403) {
description = intl.formatMessage(messages.forbiddenAlertBody, {
Expand Down Expand Up @@ -395,8 +399,7 @@ const PageAlerts = ({
dismissError={() => dispatch(dismissError(msgObj.key))}
>
<Alert.Heading>{msgObj.title}</Alert.Heading>
{(typeof msgObj.desc === 'string')
? <Truncate lines={2}>{msgObj.desc}</Truncate> : msgObj.desc}
{msgObj.desc}
</ErrorAlert>
) : (
<Alert
Expand All @@ -405,7 +408,7 @@ const PageAlerts = ({
key={msgObj.key}
>
<Alert.Heading>{msgObj.title}</Alert.Heading>
{msgObj.desc && <Truncate lines={2}>{msgObj.desc}</Truncate>}
{msgObj.desc}
</Alert>
)
))
Expand Down

0 comments on commit 0d905f9

Please sign in to comment.