Skip to content

Commit

Permalink
added login endpoints to loginpage
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeberg committed Oct 4, 2018
1 parent 6cfc38f commit 2794f9f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/Loginpage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Loginpage extends Component {
}

handleRegistration = () => {
fetch("https://kwitter-api.herokuapp.com/auth/register", {
fetch("https://team-cheese-backend.herokuapp.com/register", {
method: 'POST',
headers: {
'Content-Type': 'application/json'
Expand All @@ -41,7 +41,7 @@ class Loginpage extends Component {
}

handleLogin = () => {
fetch("https://kwitter-api.herokuapp.com/auth/login",
fetch("https://team-cheese-backend.herokuapp.com/register",
{
method: 'POST',
headers: {
Expand All @@ -55,9 +55,8 @@ class Loginpage extends Component {
})
.then(response => response.json())
.then(data => {
console.log(data.token)
this.props.dispatch(login(data.token));
if (data.token) {
console.log(data[0])
if (data[0]) {
this.setState({ loggedIn: true });
} else {
alert("Please register first.");
Expand Down

0 comments on commit 2794f9f

Please sign in to comment.