Skip to content

Commit feb28f0

Browse files
Initial commit
1 parent cd3a9c0 commit feb28f0

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,24 @@ jobs:
5555
token: ${{ secrets.CODECOV_TOKEN }}
5656

5757
deploy-vite-example:
58+
strategy:
59+
matrix:
60+
projects:
61+
- name: Vite Example Development
62+
project-id: prj_2Rq8kuNd0BmqKd2NwvkDjX9Htnx5
63+
stream-api-key: rq7ntdb4zzsq
64+
- name: Vite Example Public
65+
project-id: prj_yBYBe1AJV0tbpTqxCMzcyRfFWXxP
66+
stream-api-key: xzwhhgtazy6h
5867
runs-on: ubuntu-latest
5968
# skip if build fails
6069
needs:
6170
- build
6271
name: Deploy Vite Example to Vercel
6372
env:
6473
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
65-
VERCEL_PROJECT_ID: prj_2Rq8kuNd0BmqKd2NwvkDjX9Htnx5
66-
VITE_STREAM_API_KEY: ${{ vars.VITE_STREAM_API_KEY }}
74+
VERCEL_PROJECT_ID: ${{ matrix.projects.project-id }}
75+
VITE_STREAM_API_KEY: ${{ matrix.projects.stream-api-key }}
6776
NODE_ENV: production
6877
steps:
6978
- uses: actions/checkout@v6

examples/vite/src/App.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,20 @@ const useUser = () => {
124124
localStorage.setItem('user_id', userId);
125125
}, [userId]);
126126

127+
const environment =
128+
import.meta.env.VITE_STREAM_API_KEY === 'xzwhhgtazy6h'
129+
? 'public-shared-chat-redesign'
130+
: 'shared-chat-redesign';
131+
132+
const url = new URL('https://pronto.getstream.io/api/auth/create-token');
133+
134+
url.searchParams.set('environment', environment);
135+
url.searchParams.set('user_id', userId);
136+
127137
const tokenProvider = useCallback(() => {
128138
return token && userId === parseUserIdFromToken(token)
129139
? Promise.resolve(token)
130-
: fetch(
131-
`https://pronto.getstream.io/api/auth/create-token?environment=shared-chat-redesign&user_id=${userId}`,
132-
)
140+
: fetch(url.toString())
133141
.then((response) => response.json())
134142
.then((data) => data.token as string);
135143
}, [userId]);

0 commit comments

Comments
 (0)