Skip to content

Commit 4336654

Browse files
fix: don't use token provider for pronto-sales (#1905)
Co-authored-by: Oliver Lazoroski <oliver.lazoroski@gmail.com>
1 parent de5300b commit 4336654

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

.github/workflows/deploy-react-sample-apps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191

9292
### Vercel deployment (Preview) ###
9393
- name: Vercel Pull/Build/Deploy (Preview)
94-
if: ${{ github.ref_name != 'main' && matrix.application.manual-only != true }}
94+
if: ${{ github.ref_name != 'main' }}
9595
env:
9696
NEXT_PUBLIC_BASE_PATH: ${{ matrix.application.base-path || '' }}
9797
run: >

sample-apps/react/react-dogfood/helpers/client.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,15 @@ export const getClient = (
4646

4747
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || '';
4848

49-
export const createTokenProvider =
50-
(userId: string | undefined, environment: AppEnvironment) => async () => {
49+
export const createTokenProvider = (
50+
userId: string | undefined,
51+
environment: AppEnvironment,
52+
) => {
53+
if (process.env.NEXT_PUBLIC_APP_ENVIRONMENT === 'pronto-sales') {
54+
return undefined;
55+
}
56+
57+
return async () => {
5158
const params = new URLSearchParams({
5259
user_id: userId || '!anon',
5360
environment,
@@ -58,3 +65,4 @@ export const createTokenProvider =
5865
const json = await ((await res.json()) as Promise<CreateJwtTokenResponse>);
5966
return json.token;
6067
};
68+
};

sample-apps/react/react-dogfood/pages/api/auth/create-token.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ const createJwtToken = async (
2626
req: NextApiRequest,
2727
res: NextApiResponse<CreateJwtTokenResponse | CreateJwtTokenErrorResponse>,
2828
) => {
29+
if (process.env.NEXT_PUBLIC_APP_ENVIRONMENT === 'pronto-sales') {
30+
return error(res, 'This endpoint is not enabled', 404);
31+
}
32+
2933
const {
3034
user_id: userId = sanitizeUserId(getRandomName()),
3135
api_key: apiKeyFromRequest,

0 commit comments

Comments
 (0)