mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2026-03-10 13:15:05 +00:00
connected backend to frontend for writing microblogs
This commit is contained in:
@@ -12,6 +12,7 @@ import register from './Register.js';
|
||||
import login from './Login.js';
|
||||
import user from './pages/user';
|
||||
import writeMicroblog from './Writing_Microblogs.js';
|
||||
import userLine from './Userline.js';
|
||||
|
||||
class App extends Component {
|
||||
render() {
|
||||
@@ -25,6 +26,7 @@ class App extends Component {
|
||||
<Route exact path="/login" component={login}/>
|
||||
<Route exact path="/user" component={user}/>
|
||||
<Route exact path="/home" component={writeMicroblog}/>
|
||||
<Route exact path="/userline" component={userLine}/>
|
||||
</div>
|
||||
|
||||
</Router>
|
||||
|
||||
24
twistter-frontend/src/Userline.js
Normal file
24
twistter-frontend/src/Userline.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import React, { Component } from "react";
|
||||
import { BrowserRouter as Router } from 'react-router-dom';
|
||||
import Route from 'react-router-dom/Route';
|
||||
import axios from 'axios';
|
||||
|
||||
class Userline extends Component {
|
||||
|
||||
constructor(props)
|
||||
{
|
||||
super(props);
|
||||
this.state = {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<p>Hi</p>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default Userline;
|
||||
@@ -27,12 +27,19 @@ class Writing_Microblogs extends Component {
|
||||
|
||||
handleSubmit(event) {
|
||||
// alert('A title for the microblog was inputted: ' + this.state.title + '\nA microblog was posted: ' + this.state.value);
|
||||
const response = await axios.post(
|
||||
|
||||
const response = axios.post(
|
||||
'http://localhost:5001/twistter-e4649/us-central1/api/putPost',
|
||||
{ },
|
||||
{ body: this.state.value,
|
||||
userHandle: "new user",
|
||||
userImage: "bing-url",
|
||||
microBlogTitle: this.state.title
|
||||
|
||||
},
|
||||
{ headers: { 'Content-Type': 'application/json'} }
|
||||
)
|
||||
console.log(response.data);
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user