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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add README example using Vuex store modules #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hola-soy-milk
Copy link

Hi there!

Thanks for this helpful package.

I thought it might help to have an example showing how to set up shared mutations using a store module.

What do you think? 馃槃

Hi there!

Thanks for this helpful package.

I thought it might help to have an example showing how to set up shared mutations using a store module.

What do you think? 馃槃
@sadortun
Copy link

@xanf please merge

@tance77
Copy link

tance77 commented Aug 31, 2020

@ramonh Did this actually work for you? I tried to do this like your PR is documenting but my application just loses scope of the mutation.

@hola-soy-milk
Copy link
Author

Hey @tance77!

That's right, it worked for me. Hrm. Is it possible your store modules aren't namespaced? I noticed that mine are.

@tance77
Copy link

tance77 commented Aug 31, 2020

They definitely are namespaced.

auth.js

export default {
    namespaced: true,

I wonder if it has to do with me dynamically importing my mutations as follows:

const predicates = [];
Object.keys(modules).forEach(module => {
    Object.keys(modules[module].mutations).forEach(mutation => {
        predicates.push(module + "/" + mutation);
    });
});

Sample console log of the predicates array

Screen Shot 2020-08-31 at 2 19 33 PM

@tance77
Copy link

tance77 commented Aug 31, 2020

I figured it out. Your solution is correct. Thanks for the quick replies.

Had do do with something I commented out to accommodate this library.

@hola-soy-milk
Copy link
Author

Oh hey, awesome! Nice one 馃憤

Glad it worked! It had been a while so I was digging into my code. :)

@tance77 tance77 mentioned this pull request Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants