Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve local example for loginWith #540

Merged
merged 1 commit into from
Mar 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 39 additions & 5 deletions docs/schemes/local.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,46 @@ By default `local` scheme is enabled and preconfigured. You can set `strategies.
To do a password based login by sending credentials in request body as a JSON object:

```js
this.$auth.loginWith('local', {
data: {
username: 'your_username',
password: 'your_password'
<template>
<div>
<form @submit="userLogin">
<div>
<label>Username</label>
<input type="text" v-model="login.username" />
</div>
<div>
<label>Password</label>
<input type="text" v-model="login.password" />
</div>
<div>
<button type="submit">Submit</button>
</div>
</form>
</div>
</template>

<script>
export default {
data() {
return {
login: {
email: '',
password: ''
}
}
},
methods: {
async userLogin() {
try {
let response = await this.$auth.loginWith('local', { data: this.login })
console.log(response)
} catch (err) {
console.log(err)
}
}
}
})
}
</script>
```


Expand Down