Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added LMS_BASE_URL for brand logo #498

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/containers/LearnerDashboardHeader/BrandLogo.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import { useContext } from 'react';

import { useIntl } from '@edx/frontend-platform/i18n';

import { AppContext } from '@edx/frontend-platform/react';
import { reduxHooks } from 'hooks';

import { getConfig } from '@edx/frontend-platform';
Expand All @@ -10,9 +11,10 @@ import messages from './messages';
export const BrandLogo = () => {
const { formatMessage } = useIntl();
const dashboard = reduxHooks.useEnterpriseDashboardData();
const { config } = useContext(AppContext);

return (
<a href={dashboard?.url || '/'} className="mx-auto">
<a href={dashboard?.url || config.LMS_BASE_URL} className="mx-auto">
<img
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we be using the dynamic version of this, so it works with mfe_config? You know, getConfig().

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed, thanks 👍

className="logo py-3"
src={getConfig().LOGO_URL}
Expand Down
8 changes: 8 additions & 0 deletions src/containers/LearnerDashboardHeader/BrandLogo.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ jest.mock('hooks', () => ({
},
}));

jest.mock('@edx/frontend-platform/react', () => ({
AppContext: {
config: {
LMS_BASE_URL: '/',
},
},
}));

describe('BrandLogo', () => {
test('dashboard defined', () => {
reduxHooks.useEnterpriseDashboardData.mockReturnValueOnce({
Expand Down
Loading