diff options
author | Stefan Malzner <stefan@adlk.io> | 2019-09-04 15:37:56 +0200 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2019-09-04 15:37:56 +0200 |
commit | c6dda35baf7eb9a7d89bf224c38973a1b6171c14 (patch) | |
tree | 98f562911fcccc356a0594427f6891ce0e12f22a /src/stores | |
parent | Fix icons & button color (diff) | |
download | ferdium-app-c6dda35baf7eb9a7d89bf224c38973a1b6171c14.tar.gz ferdium-app-c6dda35baf7eb9a7d89bf224c38973a1b6171c14.tar.zst ferdium-app-c6dda35baf7eb9a7d89bf224c38973a1b6171c14.zip |
bugfixing & polishing
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/UserStore.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js index f3dfbdbf0..7ac7d2375 100644 --- a/src/stores/UserStore.js +++ b/src/stores/UserStore.js | |||
@@ -10,6 +10,8 @@ import Request from './lib/Request'; | |||
10 | import CachedRequest from './lib/CachedRequest'; | 10 | import CachedRequest from './lib/CachedRequest'; |
11 | import { gaEvent } from '../lib/analytics'; | 11 | import { gaEvent } from '../lib/analytics'; |
12 | import { sleep } from '../helpers/async-helpers'; | 12 | import { sleep } from '../helpers/async-helpers'; |
13 | import { getPlan } from '../helpers/plan-helpers'; | ||
14 | import { PLANS } from '../config'; | ||
13 | 15 | ||
14 | const debug = require('debug')('Franz:UserStore'); | 16 | const debug = require('debug')('Franz:UserStore'); |
15 | 17 | ||
@@ -150,10 +152,30 @@ export default class UserStore extends Store { | |||
150 | return this.getUserInfoRequest.execute().result || {}; | 152 | return this.getUserInfoRequest.execute().result || {}; |
151 | } | 153 | } |
152 | 154 | ||
155 | @computed get team() { | ||
156 | return this.data.team || null; | ||
157 | } | ||
158 | |||
153 | @computed get isPremium() { | 159 | @computed get isPremium() { |
154 | return !!this.data.isPremium; | 160 | return !!this.data.isPremium; |
155 | } | 161 | } |
156 | 162 | ||
163 | @computed get isPersonal() { | ||
164 | if (!this.team.plan) return false; | ||
165 | const plan = getPlan(this.team.plan); | ||
166 | |||
167 | return plan === PLANS.PERSONAL; | ||
168 | } | ||
169 | |||
170 | @computed get isPro() { | ||
171 | if (!this.team.plan && this.isPremium) return true; | ||
172 | |||
173 | if (!this.team.plan) return false; | ||
174 | const plan = getPlan(this.team.plan); | ||
175 | |||
176 | return plan === PLANS.PRO; | ||
177 | } | ||
178 | |||
157 | @computed get legacyServices() { | 179 | @computed get legacyServices() { |
158 | return this.getLegacyServicesRequest.execute() || {}; | 180 | return this.getLegacyServicesRequest.execute() || {}; |
159 | } | 181 | } |