File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
packages/app/src/app/pages Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,22 @@ import { Content } from './elements';
1212
1313const Patron : React . FC = ( ) => {
1414 const {
15- state : { user } ,
15+ state : { hasLoadedApp , isLoggedIn , user } ,
1616 actions,
1717 } = useOvermind ( ) ;
1818
19- if ( user && user . subscription && user . subscription . plan === 'pro' ) {
19+ if ( ! isLoggedIn ) {
2020 location . href = '/pro' ;
2121 }
22+ // don't send them away before authentication
23+ if ( hasLoadedApp && user ) {
24+ if (
25+ ! user . subscription || // if no subscription, get pro
26+ user . subscription . plan !== 'patron' // if subscription but not patron, go to pro
27+ ) {
28+ location . href = '/pro' ;
29+ }
30+ }
2231
2332 useEffect ( ( ) => {
2433 actions . patron . patronMounted ( ) ;
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import { UserMenu } from 'app/pages/common/UserMenu';
77import {
88 SaveAllButton ,
99 RefreshButton ,
10- PatronButton ,
1110 PreferencesButton ,
1211 NewSandboxButton ,
1312 LikeButton ,
@@ -37,7 +36,6 @@ export const Header: React.FC<IHeaderProps> = ({ zenMode }) => {
3736 preferences : {
3837 settings : { experimentVSCode : vscode } ,
3938 } ,
40- isPatron,
4139 updateStatus,
4240 hasLogIn,
4341 isLoggedIn,
@@ -65,7 +63,6 @@ export const Header: React.FC<IHeaderProps> = ({ zenMode }) => {
6563
6664 < Right >
6765 { updateStatus === 'available' && < RefreshButton /> }
68- { ! isLoggedIn || ( ! isPatron && < PatronButton /> ) }
6966 { ! isLoggedIn && < PreferencesButton /> }
7067 < NewSandboxButton />
7168 { isLoggedIn && < LikeButton /> }
You can’t perform that action at this time.
0 commit comments