question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refactor the `user` vuex module

See original GitHub issue

What 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 to data-resolvers
  • remove callback_event event’s based logic - use just the then(helperFnc) instead
  • try to remove spawnNotification move the notifications one level higher (to the UI)
  • replace all rootStore calls with the context instead (for example context.rootState)
  • remove the calls to history and me from login (it should be extremly simple) - the sessionAfterAuthorized 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 Request 2. Feature / Improvement back to develop.
  • (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 Request 3. Stabilisation fix back to release.
  • (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 or master branch and create Pull Request 4. Hotfix back to hotfix.

Additional information

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
alinadivantecommented, Jul 23, 2019

@andrzejewsky Two things to fix:

  1. When user registers new account, there is info “You are logged in” but he isn’t logged in. image Expected results: User should be automatically logged in (it works on https://demo.storefrontcloud.io)

  2. 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. image

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.

0reactions
andrzejewskycommented, Jul 25, 2019

Fixed here: #3271 everything should works now.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found