File tree Expand file tree Collapse file tree 1 file changed +7
-27
lines changed Expand file tree Collapse file tree 1 file changed +7
-27
lines changed Original file line number Diff line number Diff line change @@ -17,34 +17,14 @@ export async function conversationApi (options: ConversationRequest, abortSignal
1717}
1818
1919export async function getUserInfo ( ) : Promise < UserInfo [ ] > {
20- try {
21- const response = await fetch ( '/.auth/me' ) ;
22- if ( ! response . ok ) {
23- console . log ( 'No identity provider found. Access to chat will be blocked.' ) ;
24- return [ ] ;
25- }
26-
27- const payload = await response . json ( ) ;
28-
29- if ( payload && payload . length > 0 ) {
30- const userInfo : UserInfo = {
31- access_token : payload [ 0 ] . access_token || '' ,
32- expires_on : payload [ 0 ] . expires_on || '' ,
33- id_token : payload [ 0 ] . id_token || '' ,
34- provider_name : payload [ 0 ] . provider_name || '' ,
35- user_claims : payload [ 0 ] . user_claims || [ ] ,
36- user_id : payload [ 0 ] . user_claims ?. find ( ( claim : any ) =>
37- claim . typ === 'http://schemas.microsoft.com/identity/claims/objectidentifier'
38- ) ?. val || payload [ 0 ] . user_id || ''
39- } ;
40- return [ userInfo ] ;
41- }
42-
43- return payload ;
44- } catch ( e ) {
45- console . error ( 'Error fetching user info:' , e ) ;
46- return [ ] ;
20+ const response = await fetch ( '/.auth/me' )
21+ if ( ! response . ok ) {
22+ console . log ( 'No identity provider found. Access to chat will be blocked.' )
23+ return [ ]
4724 }
25+
26+ const payload = await response . json ( )
27+ return payload
4828}
4929
5030export const frontendSettings = async ( ) : Promise < Response | null > => {
You can’t perform that action at this time.
0 commit comments