我构建了一个laravel vue spa应用程序,并想添加一个登录名,我运行php artisan make:auth
创建了一个auth脚手架。我正在尝试使用axios调用登录路由,但是即使用户不存在,它也会一直返回成功(我已将用户手动添加到数据库中)。
这是登录组件:
<template>
<v-card class="elevation-12">
<v-container
fluid
grid-list-md
>
<v-card-text>
<v-form>
<v-text-field
box
name="login"
label="Login"
type="text"
v-model="email">
</v-text-field>
<v-text-field
box
name="password"
label="Password"
id="password"
type="password"
v-model="password">
</v-text-field>
</v-form>
</v-card-text>
<v-card-actions class="card-pb-1">
<v-btn
@click="login">Login</v-btn>
</v-card-actions>
</v-container>
</v-card>
</template>
<script>
export default {
props: {
source: String
},
data: () => ({
email: '',
password: '',
remember: ''
}),
methods: {
getLoginData () {
return {
email: this.email,
password: this.password
};
},
login() {
axios.post("/login", this.getLoginData())
.then(response => {
console.log("success");
})
.catch(error => {
console.log("error");
})
}
}
};
</script>