Skip to content

Commit

Permalink
feat: use frontend-enterprise for ent. links (#80)
Browse files Browse the repository at this point in the history
switch to using the new version of frontend-enterprise which is
compatible with both frontend-platform and frontend-auth. Also removes
the code that was duplicated from a prior version of
frontend-enterprise.

ENT-2648
  • Loading branch information
bbaker6225 authored Mar 13, 2020
1 parent ab1a30c commit 4039b79
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 84 deletions.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@commitlint/prompt": "8.2.0",
"@commitlint/prompt-cli": "8.2.0",
"@edx/frontend-build": "^2.0.4",
"@edx/frontend-enterprise": "^4.0.0",
"@edx/frontend-platform": "1.1.14",
"@edx/paragon": "7.1.5",
"codecov": "3.6.5",
Expand All @@ -61,6 +62,7 @@
"react-transition-group": "4.3.0"
},
"peerDependencies": {
"@edx/frontend-enterprise": "^4.0.0",
"@edx/frontend-platform": "^1.1.4",
"@edx/paragon": "^7.0.0",
"prop-types": "^15.5.10",
Expand Down
6 changes: 4 additions & 2 deletions src/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, { useContext, useEffect, useState } from 'react';
import Responsive from 'react-responsive';
import { getLearnerPortalLinks } from '@edx/frontend-enterprise';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { sendTrackEvent } from '@edx/frontend-platform/analytics';
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
import { AppContext } from '@edx/frontend-platform/react';
import {
APP_CONFIG_INITIALIZED,
Expand All @@ -13,7 +15,6 @@ import {

import DesktopHeader from './DesktopHeader';
import MobileHeader from './MobileHeader';
import getLearnerPortalLinks from './enterprise/getLearnerPortalLinks';

import LogoSVG from './logo.svg';

Expand All @@ -37,7 +38,8 @@ function Header({ intl }) {
const { authenticatedUser, config } = useContext(AppContext);
const [enterpriseLearnerPortalLinks, setEnterpriseLearnerPortalLinks] = useState([]);
useEffect(() => {
getLearnerPortalLinks().then((learnerPortalLinks) => {
const httpClient = getAuthenticatedHttpClient();
getLearnerPortalLinks(httpClient, authenticatedUser).then((learnerPortalLinks) => {
const links = learnerPortalLinks.map(({ url, title }) => ({
type: 'item',
href: url,
Expand Down
82 changes: 0 additions & 82 deletions src/enterprise/getLearnerPortalLinks.js

This file was deleted.

0 comments on commit 4039b79

Please sign in to comment.