diff --git a/diagrams/Block Diagram.png b/diagrams/Block Diagram.png new file mode 100644 index 0000000..5c0b0e9 Binary files /dev/null and b/diagrams/Block Diagram.png differ diff --git a/diagrams/Class Diagram.png b/diagrams/Class Diagram.png new file mode 100644 index 0000000..e38ac3e Binary files /dev/null and b/diagrams/Class Diagram.png differ diff --git a/gamersnet_frontend/package-lock.json b/gamersnet_frontend/package-lock.json index 748d4a4..b632c76 100644 --- a/gamersnet_frontend/package-lock.json +++ b/gamersnet_frontend/package-lock.json @@ -14831,12 +14831,21 @@ "is-typedarray": "^1.0.0" } }, +<<<<<<< HEAD +<<<<<<< HEAD +======= +======= +>>>>>>> befc5f3a8de6baadaa9b7b37c89a796fc77017b0 "typescript": { "version": "3.9.9", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.9.tgz", "integrity": "sha512-kdMjTiekY+z/ubJCATUPlRDl39vXYiMV9iyeMuEuXZh2we6zz80uovNN2WlAxmmdE/Z/YQe+EbOEXB5RHEED3w==", "peer": true }, +<<<<<<< HEAD +>>>>>>> frontend_signin +======= +>>>>>>> befc5f3a8de6baadaa9b7b37c89a796fc77017b0 "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", diff --git a/gamersnet_frontend/src/components/createPost/index.js b/gamersnet_frontend/src/components/createPost/index.js new file mode 100644 index 0000000..59c30ad --- /dev/null +++ b/gamersnet_frontend/src/components/createPost/index.js @@ -0,0 +1,145 @@ +import React from 'react'; +import {withRouter} from 'react-router-dom'; + +import APIFetch from '../../api'; +import './styles.css'; +class AddPost extends React.Component{ + + constructor(props){ + super(props); + + this.state = { + gameName: 'Apex Legends', + description: '', + numPlayers: 1, + gameTimeUTC: 0, + duration: '', + location: '', + message: '' + }; + + this.inputgameName = this.inputgameName.bind(this); + this.inputDescription = this.inputDescription.bind(this); + this.inputLocation = this.inputLocation.bind(this); + this.inputDuration = this.inputDuration.bind(this); + this.inputPlayers = this.inputPlayers.bind(this); + this.inputDate = this.inputDate.bind(this); + + this.handle = this.handle.bind(this); + } + + inputDescription(event){ + this.setState({description: event.target.value}); + } + + inputgameName(event){ + this.setState({gameName: event.target.value}); + } + + inputLocation(event){ + this.setState({location: event.target.value}); + } + + inputPlayers(event){ + this.setState({numPlayers: event.target.value}); + } + + inputDuration(event){ + this.setState({duration: event.target.value}); + } + + inputDate(event){ + this.setState({gameTimeUTC: event.target.valueAsNumber}); + } + + + handle(event) { + let body = { + gameName: this.state.gameName, + description: this.state.description, + numPlayers: this.state.numPlayers, + gameTimeUTC: this.state.gameTimeUTC, + duration: this.state.duration, + location: this.state.location + }; +console.log(body); + let fetchData = APIFetch('/posts/createPost', JSON.stringify(body), 'POST'); + + fetchData.then(async (data) => { + if (await data.ok) { + this.props.history.push('/'); + this.props.updateHeader(); + } else { + this.setState({message: 'something went wrong'}); + } + }); + + + event.preventDefault(); + } + + render() { + return ( +
{this.state.message}
+