MartynW
MartynW

Reputation: 699

Read data into vuex store from external file

I am starting out with vue to provide a front end for my home sensor/device setup. The set up is configured outside of vue and I wish to read in the current state of the system into vue when the app is loaded. I am using vuex to share values between components. Is there a way to read in to the vuex state from either a flat file (json) outside of the app or even a db such as sqlite? I would envisage that the population of the initial state would be achieved by a mutation as the app loads. I can’t seem to find an explanation of how to achieve this (so maybe it can't be done or I am missing something)

Thank you

Martyn

Upvotes: 0

Views: 512

Answers (1)

Raffobaffo
Raffobaffo

Reputation: 2856

As for comments. Sure, take a look here:

https://v2.vuejs.org/v2/cookbook/using-axios-to-consume-apis.html

Upvotes: 2

Related Questions