@@ -74,14 +74,12 @@ export const getSiteInfo = async function ({
7474 return { siteInfo, accounts : [ ] , addons : [ ] , integrations }
7575 }
7676
77- const promises = [
77+ const [ siteInfo , accounts , addons , integrations ] = await Promise . all ( [
7878 getSite ( api , siteId , siteFeatureFlagPrefix ) ,
7979 getAccounts ( api ) ,
8080 getAddons ( api , siteId ) ,
8181 getIntegrations ( { siteId, testOpts, offline, accountId, token, featureFlags, extensionApiBaseUrl, mode } ) ,
82- ]
83-
84- const [ siteInfo , accounts , addons , integrations ] = await Promise . all ( promises )
82+ ] )
8583
8684 if ( siteInfo . use_envelope ) {
8785 const envelope = await getEnvelope ( { api, accountId : siteInfo . account_slug , siteId, context } )
@@ -105,12 +103,28 @@ const getSite = async function (api: NetlifyAPI, siteId: string, siteFeatureFlag
105103 }
106104}
107105
108- const getAccounts = async function ( api : NetlifyAPI ) {
106+ export type MinimalAccount = {
107+ id : string
108+ name : string
109+ slug : string
110+ default : boolean
111+ team_logo_url : string | null
112+ on_pro_trial : boolean
113+ organization_id : string | null
114+ type_name : string
115+ type_slug : string
116+ members_count : number
117+ }
118+
119+ const getAccounts = async function ( api : NetlifyAPI ) : Promise < MinimalAccount [ ] > {
109120 try {
110- const accounts = await ( api as any ) . listAccountsForUser ( )
111- return Array . isArray ( accounts ) ? accounts : [ ]
121+ const accounts = ( await api . listAccountsForUser (
122+ // @ts -expect-error(ndhoule): This is an unpublished, internal querystring parameter
123+ { minimal : 'true' } ,
124+ ) ) as MinimalAccount [ ] | null
125+ return Array . isArray ( accounts ) ? ( accounts as MinimalAccount [ ] ) : [ ]
112126 } catch ( error ) {
113- throwUserError ( `Failed retrieving user account: ${ error . message } . ${ ERROR_CALL_TO_ACTION } ` )
127+ return throwUserError ( `Failed retrieving user account: ${ error . message } . ${ ERROR_CALL_TO_ACTION } ` )
114128 }
115129}
116130
0 commit comments