re-setup subproject kontor-vue
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import axios from "axios";
|
||||
|
||||
const API_URL = "http://localhost:8200/";
|
||||
|
||||
class AuthService {
|
||||
login(user) {
|
||||
return axios
|
||||
.post(API_URL + "login", {
|
||||
email: user.username,
|
||||
password: user.password,
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.data.accessToken) {
|
||||
localStorage.setItem("user", JSON.stringify(response.data));
|
||||
}
|
||||
return response.data;
|
||||
});
|
||||
}
|
||||
|
||||
logout() {
|
||||
localStorage.removeItem("user");
|
||||
}
|
||||
|
||||
register(user) {
|
||||
return axios.post(API_URL + "signup", {
|
||||
username: user.username,
|
||||
email: user.email,
|
||||
password: user.password,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default new AuthService();
|
||||
Reference in New Issue
Block a user