Skip to content

Commit 96ceab8

Browse files
fix: Redirecting to MFE home page instead of access-denied page to save redirection (#970)
1 parent f9806d0 commit 96ceab8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/alerts/active-enteprise-alert/ActiveEnterpriseAlert.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import { getConfig } from '@edx/frontend-platform';
88
import genericMessages from './messages';
99

1010
function ActiveEnterpriseAlert({ intl, payload }) {
11-
const { text } = payload;
11+
const { text, courseId } = payload;
1212
const changeActiveEnterprise = (
1313
<Hyperlink
1414
style={{ textDecoration: 'underline' }}
1515
destination={
16-
`${getConfig().LMS_BASE_URL}/enterprise/select/active/?success_url=${encodeURIComponent(global.location.href)}`
16+
`${getConfig().LMS_BASE_URL}/enterprise/select/active/?success_url=${encodeURIComponent(
17+
`${global.location.origin}/course/${courseId}/home`,
18+
)}`
1719
}
1820
>
1921
{intl.formatMessage(genericMessages.changeActiveEnterpriseLowercase)}
@@ -39,6 +41,7 @@ ActiveEnterpriseAlert.propTypes = {
3941
intl: intlShape.isRequired,
4042
payload: PropTypes.shape({
4143
text: PropTypes.string,
44+
courseId: PropTypes.string,
4245
}).isRequired,
4346
};
4447

src/alerts/active-enteprise-alert/ActiveEnterpriseAlert.test.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ describe('ActiveEnterpriseAlert', () => {
99
const mockData = {
1010
payload: {
1111
text: 'test message',
12+
courseId: 'test-course-id',
1213
},
1314
};
1415
beforeAll(async () => {
@@ -20,7 +21,7 @@ describe('ActiveEnterpriseAlert', () => {
2021
expect(screen.getByRole('alert')).toBeInTheDocument();
2122
expect(screen.getByText('test message')).toBeInTheDocument();
2223
expect(screen.getByRole('link', { name: 'change enterprise now' })).toHaveAttribute(
23-
'href', `${getConfig().LMS_BASE_URL}/enterprise/select/active/?success_url=http%3A%2F%2Flocalhost%2F`,
24+
'href', `${getConfig().LMS_BASE_URL}/enterprise/select/active/?success_url=http%3A%2F%2Flocalhost%2Fcourse%2Ftest-course-id%2Fhome`,
2425
);
2526
});
2627
});

0 commit comments

Comments
 (0)