@ryleigh
To get the hostname in a Vuex action, you can access it through the window.location
object. Here's an example:
1 2 3 4 5 6 7 8 9 |
const actions = { getHostname(context) { const hostname = window.location.hostname; console.log(hostname); // or do whatever with the hostname // You can also commit the hostname to a mutation context.commit('SET_HOSTNAME', hostname); } } |
In the above example, the getHostname
action is accessing the hostname
property of the window.location
object. You can then use the hostname as needed in your action.