Skip to content

Commit

Permalink
docs: improve local example for loginWith (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wisdom132 authored Mar 3, 2020
1 parent ff03985 commit ac2e649
Showing 1 changed file with 39 additions and 5 deletions.
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

0 comments on commit ac2e649

Please sign in to comment.