@@ -2,6 +2,7 @@ import { api } from 'api';
22import React from 'react' ;
33import { pipe , tagged , task , taskEither } from '@code-expert/prelude' ;
44import { getAccess } from '@/api/oauth/getAccess' ;
5+ import { config } from '@/config' ;
56import useTimeout from '@/ui/hooks/useTimeout' ;
67import { pkceChallenge } from '@/utils/crypto' ;
78import { ClientId } from './ClientId' ;
@@ -21,7 +22,7 @@ const startingAuthorization = (
2122) : Extract < AuthState , { _tag : 'startingAuthorization' } > => {
2223 const { code_verifier, code_challenge } = pkceChallenge ( ) ;
2324
24- const redirectLink = `${ api . CXUrl } /app/authorize?clientId=${ clientId } &code_challenge=${ code_challenge } ` ;
25+ const redirectLink = `${ config . CX_WEB_URL } /app/authorize?clientId=${ clientId } &code_challenge=${ code_challenge } ` ;
2526
2627 return authState . startingAuthorization ( { code_verifier, redirectLink } ) ;
2728} ;
@@ -84,7 +85,9 @@ export const useAuthState = (
8485
8586 if ( authState . is . waitingForAuthorization ( state ) ) {
8687 if ( sse . current == null ) {
87- sse . current = new EventSource ( `${ api . APIUrl } /app/oauth/listenForAuthToken/${ clientId } ` ) ;
88+ sse . current = new EventSource (
89+ `${ config . CX_API_URL } /app/oauth/listenForAuthToken/${ clientId } ` ,
90+ ) ;
8891 }
8992
9093 sse . current ?. addEventListener ( 'authToken' , onAuthToken , { once : true } ) ;
0 commit comments