@s-molinari @metalsadman Thank you, Yep, That solved it. I was coding from 7am till 1am yesterday so I will give myself a break (this time), still feel like a bit of an idiot though.
Thanks for your help.
Simon
@s-molinari @metalsadman Thank you, Yep, That solved it. I was coding from 7am till 1am yesterday so I will give myself a break (this time), still feel like a bit of an idiot though.
Thanks for your help.
Simon
@metalsadman Thank you. You know I always use that when using vanilla Vue, I don’t know why I didn’t already try that. I think it might be because Quasar does so much for you (which is great), but you start to stop thinking for yourself sometimes.
I will give it a try
Simon
@s-molinari Thanks Scott. I have already tried that approach. I can see the modules when I inject store, but I can not access any of the variables within State or any of the methods in actions or mutations. For example in the user module I have
state: {
user: { firstname: 'John', lastname: 'Smith', email: 'jsmith@example.com' },
token: { token: 'xxxxx', refresh_token: 'xxxxxxxx' }
}
Through injected state in axios.js
I can’t get below the base variables
user: { obj:..., proto: ....},
token: {obj: ...., proto: ....)
For now, I have worked around it by writing my token to LocalStorage, which I can access from axios.js, but I want to get this fixed, so everything is accessed through the store.
Simon
I store my JWT tokens in vuex module (user) and I have a axios request interceptor that I use to populate the Brarer token in the request head.
In vanilla Vue, I would simply import the store and then access my module state
import store from '../store/index'
var token = store.state.user.token
When I try to do this from axios.js in Quasar it does not work. Can anybody help.
A point to note, mapState in Vue files works just fine, so I’m 99.9% sure vuex is configured correctly.
I am using Quasar to write a desktop app for Mac, Windows, and Linux.
I want to make use of the window menus File, Edit, View, Window, and Help. I also want to add some other menus dynamically based on the current page. I can’t find any information in the docs or on google of how to manage those menus in Quasar. There is information in the Electron docs, but I’m not sure where I should implement that in the Quasar framework.
@metalsadman That was the first place I went and I am not new to VueJS. Below is an excerpt from that page (The one you reference), please can you explain what is different between this and what I am doing?
const store = new Vuex.Store({
state: {
count: 1
},
mutations: {
increment (state) {
// mutate state
state.count++
}
}
})
This could of course be bug with VueX but I thought I would check if the issue is specific to Quasar first.
In my vuex store file the following gives the error Error: [vuex] do not mutate vuex store state outside mutation handlers.
vxUserSetEmail (state, email) {
state.email = email
}
however this works just fine.
vxUserSetEmail (state, email) {
this.email = email
}
Can anyone explain if I am doing something wrong, or is this a bug that needs to be reported and if so, to who?