blob: 332c801766c90cd20955e4652f7098ce7cb3b433 [file] [log] [blame]
Yoshie Muranakab8b6f792019-12-03 14:47:32 -08001import api from "../api";
2
3const GlobalStore = {
4 namespaced: true,
5 state: {
6 hostName: "--",
7 hostStatus: null
8 },
9 getters: {
10 hostName(state) {
11 return state.hostName;
12 },
13 hostStatus(state) {
14 return state.hostStatus;
15 }
16 },
17 mutations: {
18 setHostName(state, hostName) {
19 state.hostName = hostName;
20 }
21 },
22 actions: {
23 getHostName({ commit }) {
24 api
25 .get("/xyz/openbmc_project/network/config/attr/HostName")
26 .then(response => {
27 const hostName = response.data.data;
28 commit("setHostName", hostName);
29 })
30 .catch(error => console.log(error));
31 }
32 }
33};
34
35export default GlobalStore;