Merge branch '21128-toolbar-context-menu'
[arvados-workbench2.git] / src / common / service-provider.ts
index 080916c55c3798d1e7e60507edff42503a9b95b0..e0504ebf8cc628898da3de5965d25ff26d93801e 100644 (file)
@@ -6,6 +6,7 @@ class ServicesProvider {
 
     private static instance: ServicesProvider;
 
+    private store;
     private services;
 
     private constructor() {}
@@ -30,6 +31,20 @@ class ServicesProvider {
         }
         return this.services;
     }
+
+    public setStore(newStore): void {
+        if (!this.store) {
+            this.store = newStore;
+        }
+    }
+
+    public getStore() {
+        if (!this.store) {
+            throw "Please check if store has been set in the index.ts before the app is initiated"; // eslint-disable-line no-throw-literal
+        }
+
+        return this.store;
+    }
 }
 
 export default ServicesProvider.getInstance();