That did the trick. Thank you so much. I apparently have some misunderstandings about exports.
Re: mixin…I’m not sure, honestly I haven’t really looked at mixins much. I’ll read more about them now to see if that makes more sense.
Thanks again!!
That did the trick. Thank you so much. I apparently have some misunderstandings about exports.
Re: mixin…I’m not sure, honestly I haven’t really looked at mixins much. I’ll read more about them now to see if that makes more sense.
Thanks again!!
Thank you for replying @metalsadman … so this means that, vuex store is only present there when it’s called during boot and not if it is called outside of that context?
My example shows it being called from a component only because I was providing myself a quick way to call it separate from boot to compare the behavior, but what I’m actually trying to achieve is access to vuex store in an external js service file. After lots of google searching I was directed to turning my service file into a boot file, but going that route doesn’t make sense for me if I can’t access those values. In regular Vue I normally import the store manually in files but doing the same thing (with the same modular vuex setup) in Quasar causes errors when trying to hit the namespaced getters. For example in a testService.js file:
import store from '../store';
function testStoreAccess() {
const requestUserName = store.getters['auth/requestUserName'];
return requestUserName;
}
export default {
testStoreAccess,
};
and in component:
import testService from '../services/testService';
export default {
created() {
const test = testService.testStoreAccess();
console.log(test);
},
};
I get the same result. Is there a quasar - specific way that you’d recommend for accessing vuex store in external js files? Thanks!
The documentation is huge for me but the CLI had me sold. I had to start learning front-end stuff as a necessity for work and originally I never wanted anything to do with javascript. I ended up on the AngularJS path at first, then after a year did some tutorials for React, then Vue, and once I got “into” Vue it just clicked. Suddenly my projects didn’t just work, they were beautiful and clean, which goes along way when you’re switching back and forth between JS and another language (Python for me) all day. Then I found Quasar which was a game changer, again not just because of the component library, but because of the CLI and the docs. The docs, with the examples and explanations really are my lifeline; being self-taught, I doubt I could get started without them.
Hello! I need help seeing what I’m missing here. I have this boot file which runs fine and outputs the expected value to console when app reloads / initializes:
function requestUserName({ store }) {
console.log(store.getters['auth/requestUserName']);
}
export default requestUserName;
However, when I call that function in a .js file or component like this:
import requestUserName from '../boot/testBootFile';
export default {
created() {
requestUserName();
},
};
I get this error:
Error in created hook: "TypeError: Cannot read property 'store' of undefined"
I’ve tried several configurations based on https://quasar.dev/quasar-cli/cli-documentation/boot-files#Accessing-data-from-boot-files page but I still can not solve this. Any help would be appreciated!