blob: 8cf2e8eb60e8c222107c72e7b46166afdaf39848 [file] [log] [blame]
Derick Montaguefded0d12019-12-11 06:16:40 -06001import api from '../api';
Yoshie Muranakab8b6f792019-12-03 14:47:32 -08002
3const GlobalStore = {
4 namespaced: true,
5 state: {
Derick Montaguefded0d12019-12-11 06:16:40 -06006 hostName: '--',
Yoshie Muranakab8b6f792019-12-03 14:47:32 -08007 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
Derick Montaguefded0d12019-12-11 06:16:40 -060025 .get('/xyz/openbmc_project/network/config/attr/HostName')
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080026 .then(response => {
27 const hostName = response.data.data;
Derick Montaguefded0d12019-12-11 06:16:40 -060028 commit('setHostName', hostName);
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080029 })
30 .catch(error => console.log(error));
31 }
32 }
33};
34
35export default GlobalStore;