Skip to content

Add README example using Vuex store modules#30

Open
hola-soy-milk wants to merge 1 commit intoxanf:masterfrom
hola-soy-milk:patch-2
Open

Add README example using Vuex store modules#30
hola-soy-milk wants to merge 1 commit intoxanf:masterfrom
hola-soy-milk:patch-2

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.

4 participants