Skip to content

Commit

Permalink
fix: check for cached app, and set when it does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
mssalemi committed Oct 3, 2024
1 parent ef0df79 commit 96b1c88
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/app/src/cli/services/generate-schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {fetchOrCreateOrganizationApp} from './context.js'
import {setCachedAppInfo} from './local-storage.js'
import {DeveloperPlatformClient, selectDeveloperPlatformClient} from '../utilities/developer-platform-client.js'
import {AppInterface} from '../models/app/app.js'
import {getAppIdentifiers} from '../models/app/identifiers.js'
Expand Down Expand Up @@ -37,7 +38,15 @@ export async function ensureConnectedAppFunctionContext(
)
}

apiKey = (await fetchOrCreateOrganizationApp(app.creationDefaultOptions())).apiKey
const createdApp = await fetchOrCreateOrganizationApp(app.creationDefaultOptions())
apiKey = createdApp.apiKey

await setCachedAppInfo({
appId: apiKey,
title: createdApp.title,
directory: app.directory,
orgId: createdApp.organizationId,
})
}
return {apiKey, developerPlatformClient}
}
Expand Down

0 comments on commit 96b1c88

Please sign in to comment.