summaryrefslogtreecommitdiff
path: root/src/store/modules/GlobalStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/modules/GlobalStore.js')
-rw-r--r--src/store/modules/GlobalStore.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/store/modules/GlobalStore.js b/src/store/modules/GlobalStore.js
new file mode 100644
index 00000000..332c8017
--- /dev/null
+++ b/src/store/modules/GlobalStore.js
@@ -0,0 +1,35 @@
+import api from "../api";
+
+const GlobalStore = {
+ namespaced: true,
+ state: {
+ hostName: "--",
+ hostStatus: null
+ },
+ getters: {
+ hostName(state) {
+ return state.hostName;
+ },
+ hostStatus(state) {
+ return state.hostStatus;
+ }
+ },
+ mutations: {
+ setHostName(state, hostName) {
+ state.hostName = hostName;
+ }
+ },
+ actions: {
+ getHostName({ commit }) {
+ api
+ .get("/xyz/openbmc_project/network/config/attr/HostName")
+ .then(response => {
+ const hostName = response.data.data;
+ commit("setHostName", hostName);
+ })
+ .catch(error => console.log(error));
+ }
+ }
+};
+
+export default GlobalStore;