@@ -21,6 +21,8 @@ import getDurationRow from '@/utils/datetime';
2121import getLocalTime from '@/utils/localtime' ;
2222import dateFormatStep , { dateFormatTime } from '@/utils/dateFormat' ;
2323import { ActionTree , Commit , MutationTree } from 'vuex' ;
24+ import graph from '@/graph' ;
25+ import { AxiosResponse } from 'axios' ;
2426
2527let timer : any = null ;
2628export interface State {
@@ -30,6 +32,7 @@ export interface State {
3032 edit : boolean ;
3133 lock : boolean ;
3234 utc : string ;
35+ version : string ;
3336}
3437const initState : State = {
3538 durationRow : getDurationRow ( ) ,
@@ -38,6 +41,7 @@ const initState: State = {
3841 edit : false ,
3942 lock : true ,
4043 utc : '' ,
44+ version : '' ,
4145} ;
4246
4347// getters
@@ -124,6 +128,9 @@ const mutations: MutationTree<State> = {
124128 [ types . SET_EDIT ] ( state : State , status : boolean ) : void {
125129 state . edit = status ;
126130 } ,
131+ [ types . SET_VERSION ] ( state : State , version : string ) : void {
132+ state . version = version ;
133+ } ,
127134} ;
128135
129136// actions
@@ -167,6 +174,13 @@ const actions: ActionTree<State, any> = {
167174 SET_LOCK ( context : { commit : Commit } , status : boolean ) : void {
168175 context . commit ( types . SET_LOCK , status ) ;
169176 } ,
177+ async FETCH_VERSION ( context : { commit : Commit } ) : Promise < void > {
178+ const res : AxiosResponse = await graph . query ( 'queryOAPVersion' ) . params ( { } ) ;
179+ if ( ! res . data . data ) {
180+ return ;
181+ }
182+ context . commit ( types . SET_VERSION , res . data . data . version ) ;
183+ } ,
170184} ;
171185
172186export default {
0 commit comments