Skip to content

Commit

Permalink
- fixes for heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
Benny Ogidan authored and Benny Ogidan committed Jan 4, 2018
1 parent 99495fe commit bbd468f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
21 changes: 12 additions & 9 deletions client/src/app/components/hoc/AdminRoutes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ const AdminRoutes = ({
isAuthenticated,
tokenExists,
isAdmin,
component: Component,
component,
...rest
}) => (
<Route
{...rest}
render={props => (isAuthenticated && isAdmin && tokenExists ?
<Component{...props} /> :
<Redirect to="/login" />)}
/>
);
}) => {
const PassedComponent = component;
return (
<Route
{...rest}
render={props => (isAuthenticated && isAdmin && tokenExists ?
<PassedComponent{...props} /> :
<Redirect to="/login" />)}
/>
);
};

AdminRoutes.defaultProps = {
isAdmin: false
Expand Down
4 changes: 1 addition & 3 deletions client/src/app/components/hoc/UserRoutes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const UserRoutes = ({
component,
...rest
}) => {
// console.log({ isAuthenticated, tokenExists });
const PassedComponent = component;
return (
<Route
Expand All @@ -25,8 +24,7 @@ const UserRoutes = ({
UserRoutes.propTypes = {
isAuthenticated: PropTypes.bool.isRequired,
component: PropTypes.func.isRequired,
tokenExists: PropTypes.bool.isRequired,
// isAdmin: PropTypes.bool.isRequired
tokenExists: PropTypes.bool.isRequired
};

const mapStateToProps = state => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ class Book extends React.Component {
showCancelButton: true,
confirmButtonText: 'Yes, delete it!',
cancelButtonText: 'No, cancel!',
confirmButtonClass: 'btn btn-success',
cancelButtonClass: 'btn btn-danger',
buttonsStyling: false,
buttonsStyling: true,
reverseButtons: true
}).then(() => {
this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class BookDetailForm extends React.PureComponent {
<TextInput
name="quantity"
type="text"
value={quantity}
value={quantity ? quantity.toString() : quantity}
onChange={onChange}
errors={errors.quantity}
label="Quantity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const BorrowHistoryTable = (props) => {
<th>User Return Date</th>
<th>Book Status</th>
<th>Overdue</th>
<th>Due In</th>
<th>Due</th>
</tr>
</thead>
<tbody>
Expand Down

0 comments on commit bbd468f

Please sign in to comment.