diff options
Diffstat (limited to 'src/store/modules/Health')
-rw-r--r-- | src/store/modules/Health/PostCodeLogsStore.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/store/modules/Health/PostCodeLogsStore.js b/src/store/modules/Health/PostCodeLogsStore.js new file mode 100644 index 00000000..ac470ece --- /dev/null +++ b/src/store/modules/Health/PostCodeLogsStore.js @@ -0,0 +1,39 @@ +import api from '@/store/api'; + +const PostCodeLogsStore = { + namespaced: true, + state: { + allPostCodes: [], + }, + getters: { + allPostCodes: (state) => state.allPostCodes, + }, + mutations: { + setAllPostCodes: (state, allPostCodes) => + (state.allPostCodes = allPostCodes), + }, + actions: { + async getPostCodesLogData({ commit }) { + return await api + .get('/redfish/v1/Systems/system/LogServices/PostCodes/Entries') + .then(({ data: { Members = [] } = {} }) => { + const postCodeLogs = Members.map((log) => { + const { Created, MessageArgs, AdditionalDataURI } = log; + return { + date: new Date(Created), + bootCount: MessageArgs[0], + timeStampOffset: MessageArgs[1], + postCode: MessageArgs[2], + uri: AdditionalDataURI, + }; + }); + commit('setAllPostCodes', postCodeLogs); + }) + .catch((error) => { + console.log('POST Codes Log Data:', error); + }); + }, + }, +}; + +export default PostCodeLogsStore; |