Skip to content

Commit

Permalink
chore: unvercel Vite
Browse files Browse the repository at this point in the history
  • Loading branch information
myandrienko committed Sep 4, 2024
1 parent 346d98d commit ea65312
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 26 deletions.
22 changes: 0 additions & 22 deletions examples/vite/README.md

This file was deleted.

1 change: 0 additions & 1 deletion examples/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"eslint-plugin-react-refresh": "^0.4.6",
"sass": "^1.75.0",
"typescript": "^5.4.5",
"vercel": "^35.2.3",
"vite": "^5.2.10"
}
}
6 changes: 3 additions & 3 deletions examples/vite/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ const params = (new Proxy(new URLSearchParams(window.location.search), {
get: (searchParams, property) => searchParams.get(property as string),
}) as unknown) as Record<string, string | null>;

const geUserIdFromToken = (token: string) => {
const parseUserIdFromToken = (token: string) => {
const [, payload] = token.split('.');

if (!payload) throw new Error('Token is missing payload');
if (!payload) throw new Error('Token is missing');

return JSON.parse(atob(payload))?.user_id;
};

const apiKey = params.key ?? (import.meta.env.VITE_STREAM_KEY as string);
const userToken = params.ut ?? (import.meta.env.VITE_USER_TOKEN as string);
const userId = geUserIdFromToken(userToken);
const userId = parseUserIdFromToken(userToken);

const filters: ChannelFilters = {
members: { $in: [userId] },
Expand Down

0 comments on commit ea65312

Please sign in to comment.