From a1f712664431b778e006da24078943b637285637 Mon Sep 17 00:00:00 2001 From: Alex Gilleran Date: Wed, 29 Aug 2018 22:42:23 +1000 Subject: [PATCH] Made href of logo link go different places based on role. --- frontend/.prettierrc | 3 +++ frontend/src/App.js | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 frontend/.prettierrc diff --git a/frontend/.prettierrc b/frontend/.prettierrc new file mode 100644 index 00000000..544138be --- /dev/null +++ b/frontend/.prettierrc @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} diff --git a/frontend/src/App.js b/frontend/src/App.js index a52eed32..2239169f 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -6,12 +6,26 @@ class App extends Component { this.props.auth.logout(); } + getLogoHref = () => { + const auth = this.props.auth; + if (!auth || !auth.isAuthenticated()) { + return '/'; + } else if (auth.hasFacilitatorPriviledge()) { + return '/facilitator'; + } else if (auth.hasDriverPriviledge()) { + return '/driver'; + } else { + return '/'; + } + }; + render() { const { isAuthenticated } = this.props.auth; + return (