diff --git a/src/DesktopHeader.jsx b/src/DesktopHeader.jsx
index d915f7812..791aac8e4 100644
--- a/src/DesktopHeader.jsx
+++ b/src/DesktopHeader.jsx
@@ -157,7 +157,7 @@ class DesktopHeader extends React.Component {
aria-label={intl.formatMessage(messages['header.label.secondary.nav'])}
className="nav secondary-menu-container align-items-center ml-auto"
>
-
+
{loggedIn
? (
<>
diff --git a/src/ThemeToggleButton.jsx b/src/ThemeToggleButton.jsx
index 862e4d01e..5b66f4ab2 100644
--- a/src/ThemeToggleButton.jsx
+++ b/src/ThemeToggleButton.jsx
@@ -3,6 +3,8 @@ import { getConfig } from '@edx/frontend-platform';
import Cookies from 'universal-cookie';
const ThemeToggleButton = () => {
+ const themeCookieName = getConfig().THEME_COOKIE_NAME ? getConfig().THEME_COOKIE_NAME : null;
+
const getNextWeek = () => {
const today = new Date();
return new Date(today.getFullYear(), today.getMonth(), today.getDate() + 7);
@@ -11,7 +13,6 @@ const ThemeToggleButton = () => {
const onToggleTheme = () => {
const cookies = new Cookies();
const serverURL = new URL(getConfig().LMS_BASE_URL);
- const themeCookieName = getConfig().THEME_COOKIE_NAME;
const options = { domain: serverURL.hostname, path: '/', expires: getNextWeek() };
let themeName = '';
@@ -26,6 +27,10 @@ const ThemeToggleButton = () => {
cookies.set(themeCookieName, themeName, options);
};
+ if (!themeCookieName) {
+ return ;
+ }
+
return (
diff --git a/src/__snapshots__/Header.test.jsx.snap b/src/__snapshots__/Header.test.jsx.snap
index eb320bef2..d96affcb8 100644
--- a/src/__snapshots__/Header.test.jsx.snap
+++ b/src/__snapshots__/Header.test.jsx.snap
@@ -43,44 +43,9 @@ exports[` renders correctly for anonymous desktop 1`] = `
className="nav secondary-menu-container align-items-center ml-auto"
>
-
-
-
-
-
-
-
-
-
-
-
-
+
renders correctly for anonymous mobile 1`] = `
/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -306,44 +232,9 @@ exports[`
renders correctly for authenticated desktop 1`] = `
className="nav secondary-menu-container align-items-center ml-auto"
>
-
-
-
-
-
-
-
-
-
-
-
-
+
renders correctly for authenticated mobile 1`] = `
/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+