Commit 35d3a47f by Sixong.Zhu

cs

parent fee0ea0d
Showing with 5 additions and 2 deletions
import { UniplatSdk } from "uniplat-sdk";
import Chat from "../xim"; import Chat from "../xim";
export type UserMapping = { export type UserMapping = {
...@@ -12,14 +13,16 @@ const userMapping: UserMapping = {}; ...@@ -12,14 +13,16 @@ const userMapping: UserMapping = {};
export const getUserMapping = () => userMapping; export const getUserMapping = () => userMapping;
export async function getUserInfo(eid: string) { export async function getUserInfo(eid: string, sdk?: UniplatSdk) {
if (userMapping[eid]) { if (userMapping[eid]) {
return userMapping[eid]; return userMapping[eid];
} }
if (!+eid) { if (!+eid) {
return { name: '', phone: '', icon: '' }; return { name: '', phone: '', icon: '' };
} }
const info = await Chat.getSdk().domainService('passport', 'anonymous', `oidc.account/user_info?id=${eid}`).request<any, any, { const info = await (sdk || Chat.getSdk())
.domainService('passport', 'anonymous', `oidc.account/user_info?id=${eid}`)
.request<any, any, {
avatar_url: string; avatar_url: string;
email: string; email: string;
id: string; id: string;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment