Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onSubmit() {
- this.loading = true;
- const body = () => ({
- username: this.username,
- password: this.password,
- });
- const processResponse = (response) => {
- this.loading = false;
- if (response.data.success) {
- this.loggedUser = response.data.username;
- } else {
- this.error = 'Incorrect username/password';
- }
- };
- const error = e => console.log(e);
- axios
- .post(`${API}/api/login`, body())
- .then(processResponse)
- .catch(error);
- }
Add Comment
Please, Sign In to add comment