Skip to content

Commit

Permalink
Replace find with filter (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
wa-rren-dev authored Nov 25, 2021
1 parent fd8d808 commit e10d9fd
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/Header/Nav/Dropdown/Components/AboutUs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import services from "../../../../services.json";
import classnames from "classnames";

export function AboutUs() {
const baseUrl = services.external.find(
const baseUrl = services.external.filter(
(service) => service.id == "about"
).href;
)[0].href;

const rootUrl = services.rootUrl;

Expand Down
3 changes: 2 additions & 1 deletion src/Header/Nav/Dropdown/Components/BNF.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import reset from "./../Reset.module.scss";
import services from "../../../../services.json";

export function BNF() {
const baseUrl = services.external.find((service) => service.id == "bnf").href;
const baseUrl = services.external.filter((service) => service.id == "bnf")[0]
.href;

const drugsAtoZurl = baseUrl + "/drug/#";

Expand Down
5 changes: 2 additions & 3 deletions src/Header/Nav/Dropdown/Components/BNFc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import reset from "./../Reset.module.scss";
import services from "../../../../services.json";

export function BNFc() {
const baseUrl = services.external.find(
(service) => service.id == "bnfc"
).href;
const baseUrl = services.external.filter((service) => service.id == "bnfc")[0]
.href;

const drugsAtoZurl = baseUrl + "/drug/#";

Expand Down
3 changes: 2 additions & 1 deletion src/Header/Nav/Dropdown/Components/CKS.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import reset from "./../Reset.module.scss";
import services from "../../../../services.json";

export function CKS() {
const baseUrl = services.external.find((service) => service.id == "cks").href;
const baseUrl = services.external.filter((service) => service.id == "cks")[0]
.href;

const topicsAtoZurl = baseUrl + "/topics/#";

Expand Down
4 changes: 2 additions & 2 deletions src/Header/Nav/Dropdown/Components/Guidance.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import reset from "./../Reset.module.scss";
import services from "../../../../services.json";

export function Guidance() {
const baseUrl = services.external.find(
const baseUrl = services.external.filter(
(service) => service.id == "guidance"
).href;
)[0].href;

return (
<section aria-label="NICE Guidance - dropdown navigation">
Expand Down
4 changes: 2 additions & 2 deletions src/Header/Nav/Dropdown/Components/LifeSciences.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import services from "../../../../services.json";
import reset from "./../Reset.module.scss";

export function LifeSciences() {
const baseUrl = services.external.find(
const baseUrl = services.external.filter(
(service) => service.id == "life-sciences"
).href;
)[0].href;

return (
<section aria-label="Life Sciences - dropdown navigation">
Expand Down

0 comments on commit e10d9fd

Please sign in to comment.