@@ -2,6 +2,7 @@ import { api } from 'api';
2
2
import React from 'react' ;
3
3
import { pipe , tagged , task , taskEither } from '@code-expert/prelude' ;
4
4
import { getAccess } from '@/api/oauth/getAccess' ;
5
+ import { config } from '@/config' ;
5
6
import useTimeout from '@/ui/hooks/useTimeout' ;
6
7
import { pkceChallenge } from '@/utils/crypto' ;
7
8
import { ClientId } from './ClientId' ;
@@ -21,7 +22,7 @@ const startingAuthorization = (
21
22
) : Extract < AuthState , { _tag : 'startingAuthorization' } > => {
22
23
const { code_verifier, code_challenge } = pkceChallenge ( ) ;
23
24
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 } ` ;
25
26
26
27
return authState . startingAuthorization ( { code_verifier, redirectLink } ) ;
27
28
} ;
@@ -84,7 +85,9 @@ export const useAuthState = (
84
85
85
86
if ( authState . is . waitingForAuthorization ( state ) ) {
86
87
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
+ ) ;
88
91
}
89
92
90
93
sse . current ?. addEventListener ( 'authToken' , onAuthToken , { once : true } ) ;
0 commit comments