diff options
author | Stefan Malzner <stefan@adlk.io> | 2019-04-30 15:23:38 +0200 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2019-04-30 15:23:38 +0200 |
commit | 1bae1dfcbc4a5f590c51103635006198ae6a91d6 (patch) | |
tree | c838e9e7e18342c01e3c3b46c8e9ca4b74895e3b /src/stores | |
parent | Update CHANGELOG.md (diff) | |
download | ferdium-app-1bae1dfcbc4a5f590c51103635006198ae6a91d6.tar.gz ferdium-app-1bae1dfcbc4a5f590c51103635006198ae6a91d6.tar.zst ferdium-app-1bae1dfcbc4a5f590c51103635006198ae6a91d6.zip |
Enforce service limit
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/FeaturesStore.js | 2 | ||||
-rw-r--r-- | src/stores/ServicesStore.js | 3 | ||||
-rw-r--r-- | src/stores/index.js | 2 |
3 files changed, 7 insertions, 0 deletions
diff --git a/src/stores/FeaturesStore.js b/src/stores/FeaturesStore.js index e7832088b..1ac05d3b9 100644 --- a/src/stores/FeaturesStore.js +++ b/src/stores/FeaturesStore.js | |||
@@ -16,6 +16,7 @@ import workspaces from '../features/workspaces'; | |||
16 | import shareFranz from '../features/shareFranz'; | 16 | import shareFranz from '../features/shareFranz'; |
17 | import announcements from '../features/announcements'; | 17 | import announcements from '../features/announcements'; |
18 | import settingsWS from '../features/settingsWS'; | 18 | import settingsWS from '../features/settingsWS'; |
19 | import serviceLimit from '../features/serviceLimit'; | ||
19 | 20 | ||
20 | import { DEFAULT_FEATURES_CONFIG } from '../config'; | 21 | import { DEFAULT_FEATURES_CONFIG } from '../config'; |
21 | 22 | ||
@@ -75,5 +76,6 @@ export default class FeaturesStore extends Store { | |||
75 | shareFranz(this.stores, this.actions); | 76 | shareFranz(this.stores, this.actions); |
76 | announcements(this.stores, this.actions); | 77 | announcements(this.stores, this.actions); |
77 | settingsWS(this.stores, this.actions); | 78 | settingsWS(this.stores, this.actions); |
79 | serviceLimit(this.stores, this.actions); | ||
78 | } | 80 | } |
79 | } | 81 | } |
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 13f929c2f..349de2c9b 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -13,6 +13,7 @@ import CachedRequest from './lib/CachedRequest'; | |||
13 | import { matchRoute } from '../helpers/routing-helpers'; | 13 | import { matchRoute } from '../helpers/routing-helpers'; |
14 | import { gaEvent, statsEvent } from '../lib/analytics'; | 14 | import { gaEvent, statsEvent } from '../lib/analytics'; |
15 | import { workspaceStore } from '../features/workspaces'; | 15 | import { workspaceStore } from '../features/workspaces'; |
16 | import { serviceLimitStore } from '../features/serviceLimit'; | ||
16 | 17 | ||
17 | const debug = require('debug')('Franz:ServiceStore'); | 18 | const debug = require('debug')('Franz:ServiceStore'); |
18 | 19 | ||
@@ -164,6 +165,8 @@ export default class ServicesStore extends Store { | |||
164 | 165 | ||
165 | // Actions | 166 | // Actions |
166 | @action async _createService({ recipeId, serviceData, redirect = true }) { | 167 | @action async _createService({ recipeId, serviceData, redirect = true }) { |
168 | if (serviceLimitStore.userHasReachedServiceLimit) return; | ||
169 | |||
167 | const data = this._cleanUpTeamIdAndCustomUrl(recipeId, serviceData); | 170 | const data = this._cleanUpTeamIdAndCustomUrl(recipeId, serviceData); |
168 | 171 | ||
169 | const response = await this.createServiceRequest.execute(recipeId, data)._promise; | 172 | const response = await this.createServiceRequest.execute(recipeId, data)._promise; |
diff --git a/src/stores/index.js b/src/stores/index.js index 1912418a2..ff01a3dd3 100644 --- a/src/stores/index.js +++ b/src/stores/index.js | |||
@@ -12,6 +12,7 @@ import RequestStore from './RequestStore'; | |||
12 | import GlobalErrorStore from './GlobalErrorStore'; | 12 | import GlobalErrorStore from './GlobalErrorStore'; |
13 | import { workspaceStore } from '../features/workspaces'; | 13 | import { workspaceStore } from '../features/workspaces'; |
14 | import { announcementsStore } from '../features/announcements'; | 14 | import { announcementsStore } from '../features/announcements'; |
15 | import { serviceLimitStore } from '../features/serviceLimit'; | ||
15 | 16 | ||
16 | export default (api, actions, router) => { | 17 | export default (api, actions, router) => { |
17 | const stores = {}; | 18 | const stores = {}; |
@@ -31,6 +32,7 @@ export default (api, actions, router) => { | |||
31 | globalError: new GlobalErrorStore(stores, api, actions), | 32 | globalError: new GlobalErrorStore(stores, api, actions), |
32 | workspaces: workspaceStore, | 33 | workspaces: workspaceStore, |
33 | announcements: announcementsStore, | 34 | announcements: announcementsStore, |
35 | serviceLimit: serviceLimitStore, | ||
34 | }); | 36 | }); |
35 | // Initialize all stores | 37 | // Initialize all stores |
36 | Object.keys(stores).forEach((name) => { | 38 | Object.keys(stores).forEach((name) => { |