Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mihaisolomon's avatar

Nova access to the vuex data from a custom tool

Hey,

There is a way to access the vuex data in a custom tool? I tried it but with no luck. Maybe I'm missing something.

What I'm thinking it's to create a endpoint from where I can get the curent user data.

Tell me your opinion on this.

Thanks.

0 likes
4 replies
bobbybouwmann's avatar

I believe you can access it through this.$store in your Tool.vue file

mihaisolomon's avatar

@bobbybouwmann you have access to it but if you refresh the page you will lose the state. The way you can access it it's like this

let user = this.$page.props.currentUser;
bobbybouwmann's avatar

@mihaisolomon Well, it is JavaScript. If you refresh you lose the state for sure. You probably have to commit the state to the store I guess. Maybe you can see how Nova itself is doing that in the code

mihaisolomon's avatar

I have this.$store but for some reason what I need to access it's null

export default {
  computed: {
  },
  
  created() {
    console.log(this.$store.getters['currentUser']);
  },

  mounted() {
    console.log(this.$store.getters['currentUser']);
  },
}

I'm missing something?

Please or to participate in this conversation.