12345678910111213141516171819202122232425262728293031323334353637 |
- import Reflux from 'reflux';
- import {SentryAppInstallation} from 'sentry/types';
- type SentryAppInstallationStoreInterface = {
- load(items: SentryAppInstallation[]): void;
- getInitialState(): SentryAppInstallation[];
- };
- const storeConfig: Reflux.StoreDefinition & SentryAppInstallationStoreInterface = {
- init() {
- this.items = [];
- },
- getInitialState(): SentryAppInstallation[] {
- return this.items;
- },
- load(items: SentryAppInstallation[]) {
- this.items = items;
- this.trigger(items);
- },
- get(uuid: string) {
- const items: SentryAppInstallation[] = this.items;
- return items.find(item => item.uuid === uuid);
- },
- getAll(): SentryAppInstallation[] {
- return this.items;
- },
- };
- const SentryAppInstallationStore = Reflux.createStore(storeConfig) as Reflux.Store &
- SentryAppInstallationStoreInterface;
- export default SentryAppInstallationStore;
|