create permissions store and write selectors

This commit is contained in:
Maren Süwer
2018-08-23 10:16:54 +02:00
parent b84472b11c
commit f81cc096aa
5 changed files with 178 additions and 30 deletions

View File

@@ -1,13 +1,46 @@
//@flow
import React from "react";
import type { History } from "history";
import connect from "react-redux/es/connect/connect";
import { translate } from "react-i18next";
import { fetchPermissions } from "../modules/permissions";
type Props = {};
type Props = {
namespace: string,
name: string,
//dispatch functions
fetchPermissions: (namespace: string, name: string) => void
};
class Permissions extends React.Component<Props> {
componentDidMount() {
const { fetchPermissions, namespace, name } = this.props;
fetchPermissions(namespace, name);
}
render() {
return <div>Permissions will be shown here!</div>;
}
}
export default Permissions;
const mapStateToProps = (state, ownProps) => {
// const { namespace, name } = ownProps.match.params;
return {
//namespace,
//name
};
};
const mapDispatchToProps = dispatch => {
return {
fetchPermissions: (namespace: string, name: string) => {
dispatch(fetchPermissions(namespace, name));
}
};
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(translate("repos")(Permissions));