bentebbutt commited on
Commit
0de3d32
·
verified ·
1 Parent(s): 2f41dd8

Update frontend/src/App.tsx

Browse files
Files changed (1) hide show
  1. frontend/src/App.tsx +16 -15
frontend/src/App.tsx CHANGED
@@ -10,21 +10,22 @@ const userEnv = {};
10
  const apiClient = new ChainlitAPI(CHAINLIT_SERVER);
11
 
12
  function App() {
13
- const { connect } = useChatSession();
14
- const session = useRecoilValue(sessionState);
15
-
16
- useEffect(() => {
17
- if (session?.socket.connected) {
18
- return
19
- }
20
- fetch(("/custom-auth")).then((res) => {
21
- return res.json();
22
- }
23
- ).then((data) => {
24
- connect({ client: apiClient, userEnv, accessToken: `Bearer: ${data.token}` });
25
- }
26
- )
27
- }, [session, connect]);
 
28
 
29
 
30
  return (
 
10
  const apiClient = new ChainlitAPI(CHAINLIT_SERVER);
11
 
12
  function App() {
13
+ const { connect } = useChatSession();
14
+ const session = useRecoilValue(sessionState);
15
+
16
+ useEffect(() => {
17
+ if (session?.socket.connected) {
18
+ return
19
+ }
20
+ fetch(apiClient
21
+ .buildEndpoint("/custom-auth")).then((res) => {
22
+ return res.json();
23
+ }
24
+ ).then((data) => {
25
+ connect({ client: apiClient, userEnv, accessToken: `Bearer: ${data.token}` });
26
+ }
27
+ )
28
+ }, []);
29
 
30
 
31
  return (