forked from grafana.jool/grafana-jool
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
530 B
28 lines
530 B
import { StoreState } from 'app/types';
|
|
import { Store } from 'redux';
|
|
|
|
export let store: Store<StoreState>;
|
|
|
|
export function setStore(newStore: Store<StoreState>) {
|
|
store = newStore;
|
|
}
|
|
|
|
export function getState(): StoreState {
|
|
if (!store || !store.getState) {
|
|
return {
|
|
templating: {
|
|
variables: {},
|
|
},
|
|
} as StoreState; // used by tests
|
|
}
|
|
|
|
return store.getState();
|
|
}
|
|
|
|
export function dispatch(action: any) {
|
|
if (!store || !store.getState) {
|
|
return;
|
|
}
|
|
|
|
return store.dispatch(action);
|
|
}
|
|
|