This commit is contained in:
@@ -4,11 +4,13 @@
|
||||
<input type="text" name="username" v-model="input.username" placeholder="Username">
|
||||
<input type="password" name="password" v-model="input.password" placeholder="Password">
|
||||
<button type="button" v-on:click="login()">Login</button>
|
||||
<button type="button" v-on:click="showlog()">ShowLog</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import auth from "../api/auth";
|
||||
import logger from "../utils/logit";
|
||||
export default {
|
||||
name: "Login",
|
||||
data() {
|
||||
@@ -21,19 +23,15 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
login() {
|
||||
logger.log("User logging in: " + this.input.username);
|
||||
if (this.input.username != "" && this.input.password != "") {
|
||||
auth
|
||||
.authenticate(this.input.username, this.input.password)
|
||||
.then(response => {
|
||||
// eslint-disable-next-line
|
||||
console.log(
|
||||
"LOGIN.VUE::login() -> SUCCESS",
|
||||
response
|
||||
);
|
||||
logger.log("LOGIN.VUE::login() -> SUCCESS", response);
|
||||
})
|
||||
.catch(function(error) {
|
||||
// eslint-disable-next-line
|
||||
console.log("LOGIN.VUE::login() !CATCH! -> Request failed", error);
|
||||
logger.log("LOGIN.VUE::login() !CATCH! -> Request failed", error);
|
||||
});
|
||||
|
||||
// if (
|
||||
@@ -48,6 +46,10 @@ export default {
|
||||
// } else {
|
||||
// alert("A username and password must be present");
|
||||
}
|
||||
},
|
||||
showlog() {
|
||||
// eslint-disable-next-line
|
||||
console.log(logger.getLog());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user