Skip to content

Commit

Permalink
Fix user loader
Browse files Browse the repository at this point in the history
  • Loading branch information
rberrelleza committed Oct 19, 2022
1 parent 178ff26 commit c0b8381
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
17 changes: 0 additions & 17 deletions frontend/src/Admin.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
import React from 'react';
import { BrowserRouter as Switch, Route, Link } from 'react-router-dom';
import { withLDConsumer } from 'launchdarkly-react-client-sdk';
import Users from './Users';

const adminSwitch = ({ flags }) => {
return (
<Switch>
{ flags.adminDashboard &&
<Route path="/admin/users">
<div className='App__nav'>
<Link to="/">Back to Movies</Link>
</div>
<Users />
</Route>
}
</Switch>
);
}

const adminLink = ({flags}) => {
return (
Expand All @@ -25,5 +9,4 @@ const adminLink = ({flags}) => {
</div>);
}

export const AdminSwitch = withLDConsumer()(adminSwitch);
export const AdminLink = withLDConsumer()(adminLink);
11 changes: 8 additions & 3 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { Component } from 'react';
import { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom';
import Loader from './Loader';
import { AdminLink, AdminSwitch } from './Admin';

import { AdminLink } from './Admin';
import Users from './Users';

import './App.css';

Expand Down Expand Up @@ -137,7 +137,12 @@ class App extends Component {
</div>
</Route>
</Switch>
<AdminSwitch />
<Route path="/admin/users">
<div className='App__nav'>
<Link to="/">Back to Movies</Link>
</div>
<Users />
</Route>
</div>
</div>
</Router>
Expand Down

0 comments on commit c0b8381

Please sign in to comment.