Refactor the `user` vuex module
See original GitHub issueWhat is the motivation for adding / enhancing this feature?
In order to prepare VS for 2.0 release we’re refactoring some vuex modules in order to keep the good practices:
- remove state write operations from the actions,
- replace state read operations with vuex getters,
- preferably migrate from events-based logic to vuex actions,
- remove notifications from vuex (
spawnNotification
), - remove
rootStore
references, - extract network calls to
data-resolveres
(as introduced in the #2890)
What are the acceptance criteria
-
resetPassword
,login
,register
,update
,me
,getOrdersHistory
network calls refactoed to helpers + then todata-resolvers
- remove
callback_event
event’s based logic - use just thethen(helperFnc)
instead - try to remove
spawnNotification
move the notifications one level higher (to the UI) - replace all
rootStore
calls with thecontext
instead (for examplecontext.rootState
) - remove the calls to
history
andme
fromlogin
(it should be extremly simple) - thesessionAfterAuthorized
should be called instead - by some observer (plugin?) on the user token - replace all
fetch
calls with Task api calls
Can you complete this feature request by yourself?
- YES
- NO
Which Release Cycle state this refers to? Info for developer.
Pick one option.
- This is a normal feature request. This should be available on https://test.storefrontcloud.io and then after tests this can be added to next Vue Storefront version. In this case Developer should create branch from
develop
branch and create Pull Request2. Feature / Improvement
back todevelop
. - (Pick this option only if you’re sure) This is an important improvement request for current Release Candidate version on https://next.storefrontcloud.io and should be placed in next RC version. In this case Developer should create branch from
release
branch and create Pull Request3. Stabilisation fix
back torelease
. - (Pick this option only if you’re sure) This is a critical improvement request for current Stable version on https://demo.storefrontcloud.io and should be placed in next stable version. In this case Developer should create branch from
hotfix
ormaster
branch and create Pull Request4. Hotfix
back tohotfix
.
Additional information
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Refactoring Vuex with Map Helpers and Modules - Vue Mastery
Our current Vuex code can be refactored into two separate standalone modules: user and event . The user module will contain all the...
Read more >Vue.js Vuex Tips And Tricks // Learn How To Refactor Your ...
There is a lot of cool resources out there for web developers. In this video I explore the top 10 best free github...
Read more >Refactor the `user` vuex module · Issue #3095 - GitHub
In order to prepare VS for 2.0 release we're refactoring some vuex modules in order to keep the good practices:.
Read more >How to Structure a Complex Vuex Store with Modules
Best practices for using Vuex modules to structure a Vuex store. Learn how to enable lazy loading of Vuex store modules and how...
Read more >javascript - Vuex 4 modules not working when refactoring ...
Now I've gotten to modules and I tried to refactor my code to modules in seprate files. Everything is working except for one...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@andrzejewsky Two things to fix:
When user registers new account, there is info “You are logged in” but he isn’t logged in. Expected results: User should be automatically logged in (it works on https://demo.storefrontcloud.io)
When I change manually token in dev console (shop/user/current-token) and open again my account and refresh page - there is info “Consumer is not authorized to access self” but user is still logged in.
Expected results: shop/user/current-token should be replaced with the valid user token from Magento. “Consumer is not authorized to access self” error shouldn’t occur.
Fixed here: #3271 everything should works now.