Commit f5b80e76 authored by TJHeeringa's avatar TJHeeringa

Removed Hornet

parent ddbb8b76
import {AvForm, AvInput} from "availity-reactstrap-validation";
import React, { Component } from "react";
import {Button, FormGroup} from "reactstrap";
export class AssociationHornetForm extends Component {
handleValidSubmit(event, values) {
let {association} = this.props;
association.hornet_api_key = values.hornet_api_key;
this.putHornetSettings(association);
}
putHornetSettings(association){
console.log(association);
return fetch(association.url, {
method: "PUT",
redirect: "follow",
headers: {
"Authorization": localStorage.getItem("SUN_api_token"),
"Content-Type": "application/json"
},
body:JSON.stringify(association)
}).then(function (resp) {
return resp.json();
});
}
render() {
const {association} = this.props;
return (
<AvForm id={"association_hornet_form"} onValidSubmit={this.handleValidSubmit} ref={c => (this.form = c)}>
<label>API Key</label>
<FormGroup className={"FormGroup"}>
<AvInput
type={"text"}
name={"api_key"}
value={association.hornet_api_key}
/>
</FormGroup>
<Button className={"acceptbutton"} color={"primary"}>Update</Button>
</AvForm>
);
}
}
import { Helper } from "App/Helper";
import { AvForm, AvInput } from "availity-reactstrap-validation";
import PropTypes from "prop-types";
import React from "react";
import { Button, FormGroup } from "reactstrap";
const ProfileHornetForm = (props) => {
const {association} = props;
const handleValidSubmit = (event, values) => {
return Helper.api_callv2({
url: association.url,
method: "PATCH",
object: {hornet_api_key: values.hornet_api_key},
});
};
return (
<AvForm id={"association_hornet_form"} onValidSubmit={handleValidSubmit}>
<label>API Key</label>
<FormGroup className={"FormGroup"}>
<AvInput
type={"text"}
name={"api_key"}
value={association.hornet_api_key}
/>
</FormGroup>
<Button className={"acceptbutton"} color={"primary"}>Update</Button>
</AvForm>
);
};
ProfileHornetForm.propTypes = {
association: PropTypes.object
};
\ No newline at end of file
...@@ -5,12 +5,7 @@ import React from "react"; ...@@ -5,12 +5,7 @@ import React from "react";
import Block from "../../../Components/PageLayout/Content/Block"; import Block from "../../../Components/PageLayout/Content/Block";
const TextBlock = (props) => { const TextBlock = ({ title, body, children }) => {
// eslint-disable-next-line react/prop-types
const { children } = props;
const { title, body } = props;
return ( return (
<Block> <Block>
<Typography variant={"h4"}>{ title }</Typography> <Typography variant={"h4"}>{ title }</Typography>
...@@ -24,7 +19,8 @@ const TextBlock = (props) => { ...@@ -24,7 +19,8 @@ const TextBlock = (props) => {
TextBlock.propTypes = { TextBlock.propTypes = {
title: PropTypes.string.isRequired, title: PropTypes.string.isRequired,
body: PropTypes.string.isRequired body: PropTypes.string.isRequired,
children: PropTypes.node
}; };
export default TextBlock; export default TextBlock;
\ No newline at end of file
...@@ -20,7 +20,8 @@ const AvatarMenu = ({ children }) => { ...@@ -20,7 +20,8 @@ const AvatarMenu = ({ children }) => {
} else { } else {
avatar_menu_items = [ avatar_menu_items = [
{to: "/account/login", icon: <FaSignInAlt/>, primary: "Login"}, {to: "/account/login", icon: <FaSignInAlt/>, primary: "Login"},
{to: "/account/signup", icon: <FaRegistered/>, primary: "Register"}, {to: "/help", icon: <ContactSupportIcon/>, primary: "Help"},
// {to: "/account/signup", icon: <FaRegistered/>, primary: "Register"},
]; ];
} }
......
import Container from "@material-ui/core/Container";
import Typography from "@material-ui/core/Typography";
import { AssociationHornetForm } from "App/Components/Forms/HornetForm";
import PropTypes from "prop-types";
import React from "react";
import { withRouter } from "react-router-dom";
import Block from "../../Components/PageLayout/Content/Block";
const Hornet = (props) => {
const { association } = props;
const handleValidSubmit = (event, values) => {
//TODO: update association settings in API
console.log(values);
};
return (
<Container>
<Block>
<Typography variant={"h5"}>ASSOCIATION Hornet</Typography>
<hr className={"box-title-separator"}/>
<AssociationHornetForm
association={association}
/>
</Block>
</Container>
);
};
Hornet.propTypes = {
association: PropTypes.object.isRequired
};
export const AssociationHornetWithRouter = withRouter(Hornet);
\ No newline at end of file
...@@ -85,8 +85,8 @@ const MembershipRequest = (props) => { ...@@ -85,8 +85,8 @@ const MembershipRequest = (props) => {
value: value value: value
}); });
} }
return Helper.api_callv2({ return Helper.api_callv3({
url: process.env.REACT_APP_API_URL + "/memberships", url: "/memberships",
method: "POST", method: "POST",
object: { object: {
profile: profile.url, profile: profile.url,
......
import { CommitteesArchiveWithRouter } from "App/Pages/Archives/CommitteesArchive"; import { CommitteesArchiveWithRouter } from "App/Pages/Archives/CommitteesArchive";
import { AssociationDataFieldsWithRouter } from "App/Pages/Association/AssociationDataFields"; import { AssociationDataFieldsWithRouter } from "App/Pages/Association/AssociationDataFields";
import { AssociationHornetWithRouter } from "App/Pages/Association/AssociationHornet";
import { AssociationInfoWithRouter } from "App/Pages/Association/AssociationInfo"; import { AssociationInfoWithRouter } from "App/Pages/Association/AssociationInfo";
import { AssociationMembertypes } from "App/Pages/Association/AssociationMembertypes"; import { AssociationMembertypes } from "App/Pages/Association/AssociationMembertypes";
import Home from "App/Pages/Association/Home/board"; import Home from "App/Pages/Association/Home/board";
...@@ -72,16 +71,6 @@ const BoardMemberRoutes = (props) => { ...@@ -72,16 +71,6 @@ const BoardMemberRoutes = (props) => {
/> />
} }
/> />
{ /*Association hornet*/ }
<Route
exact
path={path+"/association/hornet"}
render={() =>
<AssociationHornetWithRouter
association={association}
/>
}
/>
{ /*Shared user profile*/ } { /*Shared user profile*/ }
<Route <Route
path={path+"/committeesarchive"} path={path+"/committeesarchive"}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment