aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/UserStore.js
diff options
context:
space:
mode:
authorLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-09-05 17:28:21 +0200
committerLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-09-05 17:28:21 +0200
commit79105b086dc4bcebe994457e17e72cb03acfde5c (patch)
tree1d3d4276ee3a77e4f8071a31ce2d68adb2ce6186 /src/stores/UserStore.js
parentUpdate defaultMessages.json (diff)
downloadferdium-app-79105b086dc4bcebe994457e17e72cb03acfde5c.tar.gz
ferdium-app-79105b086dc4bcebe994457e17e72cb03acfde5c.tar.zst
ferdium-app-79105b086dc4bcebe994457e17e72cb03acfde5c.zip
Fix race condition when team data is not yet loaded
Diffstat (limited to 'src/stores/UserStore.js')
-rw-r--r--src/stores/UserStore.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js
index 6e6f745c7..b652098f9 100644
--- a/src/stores/UserStore.js
+++ b/src/stores/UserStore.js
@@ -161,11 +161,11 @@ export default class UserStore extends Store {
161 } 161 }
162 162
163 @computed get isPremiumOverride() { 163 @computed get isPremiumOverride() {
164 return (!this.team.plan && this.isPremium) || (this.team.state === 'expired' && this.isPremium); 164 return ((!this.team || !this.team.plan) && this.isPremium) || (this.team.state === 'expired' && this.isPremium);
165 } 165 }
166 166
167 @computed get isPersonal() { 167 @computed get isPersonal() {
168 if (!this.team.plan) return false; 168 if (!this.team || !this.team.plan) return false;
169 const plan = getPlan(this.team.plan); 169 const plan = getPlan(this.team.plan);
170 170
171 return plan === PLANS.PERSONAL; 171 return plan === PLANS.PERSONAL;
@@ -174,7 +174,7 @@ export default class UserStore extends Store {
174 @computed get isPro() { 174 @computed get isPro() {
175 if (this.isPremiumOverride) return true; 175 if (this.isPremiumOverride) return true;
176 176
177 if ((!this.team.plan || this.team.state === 'expired')) return false; 177 if (!this.team || (!this.team.plan || this.team.state === 'expired')) return false;
178 const plan = getPlan(this.team.plan); 178 const plan = getPlan(this.team.plan);
179 179
180 return plan === PLANS.PRO || plan === PLANS.LEGACY; 180 return plan === PLANS.PRO || plan === PLANS.LEGACY;