-
Notifications
You must be signed in to change notification settings - Fork 927
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
Add option fetchUser #27
Add option fetchUser #27
Conversation
lib/templates/auth.store.js
Outdated
@@ -146,7 +146,9 @@ export default { | |||
<% } %> | |||
|
|||
// Fetch authenticated user | |||
<% if (options.user.fetchUser) { %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR. What's your idea if we conditionally remove fetchUser action from store too when this option is false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my project I don't keep a state of user, token is enough therefore I wanted to make this conditional
@ernestas-poskus I think we need to update this lines too :
|
maybe better name would be |
6b4f4ac
to
885d7a5
Compare
updated and renamed to |
offtopic: is there a way to handle API error after dispatching?
|
Thanks for your contribution. Now changes seems good enough for merging... For dispatch error handling can't ce just await on store.dispatch like this ? try {
await store.dispatch('auth/login', {
fields: {
username: 'your_username',
password: 'your_password'
}
})
} catch (e) {
// Handle error
} |
I will try this, thanks ! |
Adding option fetchUser which allows control of fetching authenticated user.
cc @pi0