()
| 2169 | user_id: userId || label, |
| 2170 | label, |
| 2171 | role_name: raw?.role_name || "", |
| 2172 | description: raw?.description || "", |
| 2173 | affiliation: raw?.affiliation || raw?.institution || raw?.organization || "", |
| 2174 | has_profile: Boolean(raw?.has_profile), |
| 2175 | updated_at: raw?.updated_at || "", |
| 2176 | is_current: Boolean(raw?.is_current) |
| 2177 | }; |
| 2178 | } |
| 2179 | |
| 2180 | async function loadUsers() { |
| 2181 | const data = await api("/api/users"); |
| 2182 | state.users = data.users && data.users.length ? data.users.map(normalizeUser) : [normalizeUser("user_demo")]; |
| 2183 | const ids = state.users.map((user) => user.user_id); |
| 2184 | const current = state.users.find((user) => user.is_current) || state.users[0]; |
| 2185 | if (!ids.includes(state.currentUser)) state.currentUser = current.user_id; |
no test coverage detected