fix: render searched agency profile
This commit is contained in:
parent
3b0dd2e800
commit
9b17737ca8
@ -85,6 +85,6 @@
|
||||
|
||||
<div class="home-indicator" aria-hidden="true"></div>
|
||||
</div>
|
||||
<script src="./script.js?v=20260428-1535" defer></script>
|
||||
<script src="./script.js?v=20260428-2080" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -292,7 +292,43 @@
|
||||
}
|
||||
|
||||
function pickProfile(body) {
|
||||
return body?.teamProfile || body?.ownUserProfile || body?.userProfile || body || null;
|
||||
return body?.ownUserProfile || body?.userProfile || body?.teamProfile || body || null;
|
||||
}
|
||||
|
||||
function pickSpecialAccount(profile) {
|
||||
return profile?.ownSpecialId?.account ||
|
||||
profile?.specialId?.account ||
|
||||
profile?.specialAccount ||
|
||||
profile?.shortAccount ||
|
||||
profile?.shortId ||
|
||||
"";
|
||||
}
|
||||
|
||||
function pickSearchAgency(body) {
|
||||
const teamProfile = body?.teamProfile || null;
|
||||
const userProfile = body?.ownUserProfile || body?.userProfile || teamProfile?.ownUserProfile || teamProfile?.userProfile || null;
|
||||
if (!teamProfile?.id) return null;
|
||||
|
||||
const specialAccount = pickSpecialAccount(userProfile) || pickSpecialAccount(teamProfile);
|
||||
|
||||
return {
|
||||
...(teamProfile || {}),
|
||||
...(userProfile || {}),
|
||||
id: teamProfile.id,
|
||||
teamId: teamProfile.id,
|
||||
teamName: teamProfile.teamName || userProfile?.teamName || "",
|
||||
userNickname: userProfile?.userNickname || teamProfile.userNickname || teamProfile.name || teamProfile.teamName || "",
|
||||
name: userProfile?.name || teamProfile.name || teamProfile.teamName || "",
|
||||
userAvatar: userProfile?.userAvatar || teamProfile.userAvatar || userProfile?.avatar || teamProfile.avatar || "",
|
||||
avatar: userProfile?.avatar || teamProfile.avatar || userProfile?.userAvatar || teamProfile.userAvatar || "",
|
||||
displayAccount: specialAccount || userProfile?.account || teamProfile.account || "",
|
||||
account: userProfile?.account || teamProfile.account || "",
|
||||
ownSpecialId: userProfile?.ownSpecialId || teamProfile.ownSpecialId || (specialAccount ? { account: specialAccount } : null),
|
||||
specialId: userProfile?.specialId || teamProfile.specialId || null,
|
||||
specialAccount,
|
||||
shortAccount: userProfile?.shortAccount || teamProfile.shortAccount || "",
|
||||
shortId: userProfile?.shortId || teamProfile.shortId || ""
|
||||
};
|
||||
}
|
||||
|
||||
function pickName(profile) {
|
||||
@ -300,7 +336,7 @@
|
||||
}
|
||||
|
||||
function pickAccount(profile) {
|
||||
return profile?.ownSpecialId?.account || profile?.account || profile?.id || "-";
|
||||
return pickSpecialAccount(profile) || profile?.displayAccount || profile?.account || profile?.id || "-";
|
||||
}
|
||||
|
||||
function initials(name) {
|
||||
@ -395,7 +431,7 @@
|
||||
|
||||
try {
|
||||
const body = await apiRequest(`/team/search-account?account=${encodeURIComponent(account)}`);
|
||||
const profile = body?.teamProfile || null;
|
||||
const profile = pickSearchAgency(body);
|
||||
if (!profile?.id) {
|
||||
foundAgency = null;
|
||||
renderFoundAgency(null);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user