2020-11-19 19:39:22 +01:00
|
|
|
import API from "./api"
|
2020-11-11 13:25:50 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Performs a log in request.
|
|
|
|
*/
|
|
|
|
export const logIn = async ({ username, password }) => {
|
|
|
|
if (!username) {
|
2020-11-19 19:39:22 +01:00
|
|
|
return API.error("Please enter your username")
|
2020-11-11 13:25:50 +01:00
|
|
|
}
|
|
|
|
if (!password) {
|
2020-11-19 19:39:22 +01:00
|
|
|
return API.error("Please enter your password")
|
2020-11-11 13:25:50 +01:00
|
|
|
}
|
2020-11-19 19:39:22 +01:00
|
|
|
return await API.post({
|
2020-11-11 13:25:50 +01:00
|
|
|
url: "/api/authenticate",
|
|
|
|
body: { username, password },
|
|
|
|
})
|
|
|
|
}
|