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 { connect } from "react-redux";
import { jhapiRequest } from "../../util/jhapiUtil";
import { Groups } from "./Groups.pre";
import Groups from "./Groups.pre";
const withGroupsAPI = withProps((props) => ({
refreshGroupsData: () =>

View File

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