Skip to content

Commit 53179bd

Browse files
authored
Merge pull request #473 from google/fix/no-accounts-message
set errorCode state to true if no accounts are found
2 parents 7698541 + 2edd8fc commit 53179bd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

assets/js/modules/analytics/setup.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,12 @@ class AnalyticsSetup extends Component {
259259

260260
const responseData = await data.get( 'modules', 'analytics', 'get-accounts', queryArgs, false );
261261
if ( 0 === responseData.accounts.length ) {
262+
newState = {
263+
...newState,
264+
errorCode: 'no_account',
265+
errorReason: 'noAccount',
266+
};
267+
262268
// clear the cache.
263269
data.deleteCache( 'analytics', 'get-accounts' );
264270
} else if ( ! selectedAccount ) {
@@ -298,7 +304,7 @@ class AnalyticsSetup extends Component {
298304

299305
newState = {
300306
...newState,
301-
errorCode: true,
307+
errorCode: 'insufficient_permissions',
302308
errorReason: 'insufficientPermissions',
303309
};
304310
}
@@ -860,6 +866,10 @@ class AnalyticsSetup extends Component {
860866
onSettingsPage,
861867
} = this.props;
862868

869+
if ( ! errorCode ) {
870+
return null;
871+
}
872+
863873
let showErrorFormat = true; // default error message.
864874
let message = errorMsg;
865875

0 commit comments

Comments
 (0)