mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-16 10:18:48 +00:00
revert changes that I f ed up
This commit is contained in:
parent
649b9b4a69
commit
35e5cf8e9d
@ -4,28 +4,29 @@ import Route from "react-router-dom/Route";
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
class Writing_Microblogs extends Component {
|
class Writing_Microblogs extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
value: '',
|
value: "",
|
||||||
title: '',
|
title: "",
|
||||||
topics: '',
|
topics: "",
|
||||||
characterCount: 250
|
characterCount: 250
|
||||||
|
};
|
||||||
|
|
||||||
};
|
this.handleChange = this.handleChange.bind(this);
|
||||||
|
this.handleSubmit = this.handleSubmit.bind(this);
|
||||||
|
this.handleChangeforPost = this.handleChangeforPost.bind(this);
|
||||||
this.handleChange = this.handleChange.bind(this);
|
this.handleChangeforTopics = this.handleChangeforTopics.bind(this);
|
||||||
this.handleSubmit = this.handleSubmit.bind(this);
|
}
|
||||||
this.handleChangeforPost = this.handleChangeforPost.bind(this);
|
|
||||||
this.handleChangeforTopics = this.handleChangeforTopics.bind(this);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
handleChange(event) {
|
handleChange(event) {
|
||||||
this.setState({ title: event.target.value });
|
this.setState({ title: event.target.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleChangeforTopics(event) {
|
||||||
|
this.setState({ topics: event.target.value });
|
||||||
|
}
|
||||||
|
|
||||||
handleSubmit(event) {
|
handleSubmit(event) {
|
||||||
// alert('A title for the microblog was inputted: ' + this.state.title + '\nA microblog was posted: ' + this.state.value);
|
// alert('A title for the microblog was inputted: ' + this.state.title + '\nA microblog was posted: ' + this.state.value);
|
||||||
const postData = {
|
const postData = {
|
||||||
@ -38,45 +39,6 @@ class Writing_Microblogs extends Component {
|
|||||||
headers: { "Content-Type": "application/json" }
|
headers: { "Content-Type": "application/json" }
|
||||||
};
|
};
|
||||||
|
|
||||||
handleSubmit(event) {
|
|
||||||
|
|
||||||
const postData = {
|
|
||||||
body: this.state.value,
|
|
||||||
userImage: "bing-url",
|
|
||||||
microBlogTitle: this.state.title,
|
|
||||||
microBlogTopics: this.state.topics.split(', ')
|
|
||||||
}
|
|
||||||
const headers = {
|
|
||||||
headers: { 'Content-Type': 'application/json'}
|
|
||||||
}
|
|
||||||
|
|
||||||
axios
|
|
||||||
.post("/putPost", postData, headers)
|
|
||||||
.then((res) =>{
|
|
||||||
alert('Post was shared successfully!')
|
|
||||||
console.log(res.data);
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
alert('An error occured.');
|
|
||||||
console.error(err);
|
|
||||||
})
|
|
||||||
event.preventDefault();
|
|
||||||
this.setState({value: '', title: '',characterCount: 250, topics: ''})
|
|
||||||
}
|
|
||||||
|
|
||||||
handleSubmit(event) {
|
|
||||||
// alert('A title for the microblog was inputted: ' + this.state.title + '\nA microblog was posted: ' + this.state.value);
|
|
||||||
const postData = {
|
|
||||||
body: this.state.value,
|
|
||||||
userHandle: "new user",
|
|
||||||
userImage: "bing-url",
|
|
||||||
microBlogTitle: this.state.title,
|
|
||||||
microBlogTopics: this.state.topics.split(", ")
|
|
||||||
};
|
|
||||||
const headers = {
|
|
||||||
headers: { "Content-Type": "application/json" }
|
|
||||||
};
|
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.post("/putPost", postData, headers)
|
.post("/putPost", postData, headers)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user