- if (error) return console.error(error);
- if (result.statusCode === 401) return console.error('Invalid credentials');
+ superagent.post('/api/login').send({ username: that.loginData.username, password: that.loginData.password }).end(function (error, result) {
+ that.loginData.busy = false;
+
+ if (error && !result) return that.$message.error(error.message);
+ if (result.statusCode === 401) return that.$message.error('Wrong username or password');