Created
September 5, 2018 03:16
-
-
Save Jossdz/143ecde387e5b8c20b9d5baced3f667e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios' | |
const baseUrl = `http://localhost:3000/auth` | |
export const newUser = (username, password) => { | |
return axios | |
.post(`${baseUrl}/signup`,{ | |
username, | |
password | |
}) | |
} | |
export const login = (username, password) => { | |
return axios | |
.post(`${baseUrl}/login`, { | |
username, | |
password | |
}) | |
} | |
export const logout = () => { | |
return axios | |
.get(`${baseUrl}/logout`) | |
.then(localStorage.removeItem('username')) | |
.then(document.location.reload()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment