Skip to content

Commit

Permalink
test: use enviroment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
arnautov-anton committed Aug 25, 2022
1 parent 78123c6 commit 21ae4e6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
10 changes: 6 additions & 4 deletions test-react-frameworks/next/next-page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck

import { NextPage } from 'next';
import React from 'react';

Expand All @@ -13,11 +15,11 @@ import {
Window,
} from 'stream-chat-react';

const apiKey = process.env.NEXT_PUBLIC_STREAM_KEY || 'API_KEY';
const userId = process.env.NEXT_PUBLIC_USER_ID || 'USER_ID';
const userToken = process.env.NEXT_PUBLIC_USER_TOKEN || 'USER_TOKEN';
const apiKey = process.env.STREAM_API_KEY || 'API_KEY';
const userId = process.env.USER_ID || 'USER_ID';
const userToken = process.env.USER_TOKEN || 'USER_TOKEN';

const options = { state: true, presence: true, limit: 10 };
const options = { limit: 10, presence: true, state: true };

const chatClient = StreamChat.getInstance(apiKey);

Expand Down
22 changes: 11 additions & 11 deletions test-react-frameworks/remix/remix-index-route.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-nocheck

import { LinksFunction } from '@remix-run/node';
import { Link } from '@remix-run/react';
import React from 'react';

import { StreamChat } from 'stream-chat';
Expand All @@ -14,24 +15,23 @@ import {
Window,
} from 'stream-chat-react';

const options = { state: true, presence: true, limit: 10 };
const apiKey = process.env.STREAM_API_KEY || 'API_KEY';
const userId = process.env.USER_ID || 'USER_ID';
const userToken = process.env.USER_TOKEN || 'USER_TOKEN';

const options = { limit: 10, presence: true, state: true };

import stream from 'stream-chat-react/dist/css/index.css';

export const links: LinksFunction = () => [{ rel: 'stylesheet', href: stream }];
export const links: LinksFunction = () => [{ href: stream, rel: 'stylesheet' }];

export default function Index() {
const [client, setClient] = React.useState<StreamChat | null>(null);

React.useEffect(() => {
const chatClient = StreamChat.getInstance('pnxrtw9c3jeq');

chatClient
.connectUser(
{ id: 'test-user-1' },
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidGVzdC11c2VyLTEifQ.gRbKDG6PYuqCmvpBHKk4ibdz-WO9YiOTVmpG7gw9o74',
)
.then(() => setClient(chatClient));
const chatClient = StreamChat.getInstance(apiKey);

chatClient.connectUser({ id: userId }, userToken).then(() => setClient(chatClient));
}, []);

if (client === null) {
Expand Down
8 changes: 3 additions & 5 deletions test-react-frameworks/vite/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ import {

import 'stream-chat-react/dist/css/index.css';

const apiKey = (import.meta.env.STREAM_API_KEY as string) ?? 'pnxrtw9c3jeq';
const userId = (import.meta.env.USER_ID as string) ?? 'test-user-1';
const userToken =
(import.meta.env.USER_TOKEN as string) ??
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidGVzdC11c2VyLTEifQ.gRbKDG6PYuqCmvpBHKk4ibdz-WO9YiOTVmpG7gw9o74';
const apiKey = (import.meta.env.STREAM_API_KEY as string) ?? 'API_KEY';
const userId = (import.meta.env.USER_ID as string) ?? 'USER_ID';
const userToken = (import.meta.env.USER_TOKEN as string) ?? 'USER_TOKEN';

type LocalAttachmentType = Record<string, unknown>;
type LocalChannelType = Record<string, unknown>;
Expand Down

0 comments on commit 21ae4e6

Please sign in to comment.