Make Groups functional

This commit is contained in:
Nathan Barber
2021-04-07 12:06:38 -04:00
parent 816eeeb2fc
commit 6a1a4de329
4 changed files with 81 additions and 86 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
import { compose, withProps } from "recompose"; import { compose, withProps } from "recompose";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { jhapiRequest } from "../../util/jhapiUtil"; import { jhapiRequest } from "../../util/jhapiUtil";
import { Groups } from "./Groups.pre"; import Groups from "./Groups.pre";
const withGroupsAPI = withProps((props) => ({ const withGroupsAPI = withProps((props) => ({
refreshGroupsData: () => refreshGroupsData: () =>

View File

@@ -2,27 +2,14 @@ import React, { Component } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
export class Groups extends Component { const Groups = (props) => {
static get propTypes() {
return {
user_data: PropTypes.array,
groups_data: PropTypes.array,
refreshUserData: PropTypes.func,
refreshGroupsData: PropTypes.func,
};
}
constructor(props) {
super(props);
}
render() {
var { var {
user_data, user_data,
groups_data, groups_data,
refreshGroupsData, refreshGroupsData,
refreshUserData, refreshUserData,
} = this.props; history
} = props;
if (!groups_data || !user_data) { if (!groups_data || !user_data) {
return <div></div>; return <div></div>;
@@ -72,7 +59,7 @@ export class Groups extends Component {
<button <button
className="btn btn-primary adjacent-span-spacing" className="btn btn-primary adjacent-span-spacing"
onClick={() => { onClick={() => {
this.props.history.push("/create-group"); history.push("/create-group");
}} }}
> >
New Group New Group
@@ -83,5 +70,13 @@ export class Groups extends Component {
</div> </div>
</div> </div>
); );
} };
}
Groups.propTypes = {
user_data: PropTypes.array,
groups_data: PropTypes.array,
refreshUserData: PropTypes.func,
refreshGroupsData: PropTypes.func,
};
export default Groups;

File diff suppressed because one or more lines are too long