Skip to content

Commit 9b406d6

Browse files
new1
1 parent 014801f commit 9b406d6

File tree

1 file changed

+7
-27
lines changed

1 file changed

+7
-27
lines changed

src/frontend/src/api/api.ts

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,14 @@ export async function conversationApi (options: ConversationRequest, abortSignal
1717
}
1818

1919
export 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

5030
export const frontendSettings = async (): Promise<Response | null> => {

0 commit comments

Comments
 (0)