diff --git a/frontend/src/routes/(authenticated)/org/[org_id]/+page.svelte b/frontend/src/routes/(authenticated)/org/[org_id]/+page.svelte index 75c7c376b..a3e309ff2 100644 --- a/frontend/src/routes/(authenticated)/org/[org_id]/+page.svelte +++ b/frontend/src/routes/(authenticated)/org/[org_id]/+page.svelte @@ -8,7 +8,7 @@ import type { PageData } from './$types'; import { OrgRole } from '$lib/gql/types'; import { useNotifications } from '$lib/notify'; - import { _changeOrgName, _deleteOrgUser, _deleteOrg, type OrgSearchParams, type User, type OrgUser } from './+page'; + import { _changeOrgName, _deleteOrgUser, _deleteOrg, _orgMemberById, type OrgSearchParams, type User, type OrgUser } from './+page'; import OrgTabs, { type OrgTabId } from './OrgTabs.svelte'; import { getSearchParams, queryParam } from '$lib/util/query-params'; import { Icon, TrashIcon } from '$lib/icons'; @@ -48,8 +48,10 @@ } let userModal: UserModal; - function openUserModal(user: User): Promise { + async function openUserModal(user: User): Promise { // Although we receive a TableUser, we know in practice it's a full User object + const queryUser = await _orgMemberById(org.id, user.id); + console.log('_orgMemberById returned', queryUser); return userModal.open(user); } diff --git a/frontend/src/routes/(authenticated)/org/[org_id]/+page.ts b/frontend/src/routes/(authenticated)/org/[org_id]/+page.ts index 0f48010bc..3ada7c550 100644 --- a/frontend/src/routes/(authenticated)/org/[org_id]/+page.ts +++ b/frontend/src/routes/(authenticated)/org/[org_id]/+page.ts @@ -6,6 +6,8 @@ import type { ChangeOrgNameMutation, DeleteOrgMutation, DeleteOrgUserMutation, + GqlResult, + OrgMemberDto, OrgPageQuery, OrgRole, } from '$lib/gql/types'; @@ -167,6 +169,43 @@ export async function _addOrgMember(orgId: UUID, emailOrUsername: string, role: return result; } +// NOT WOKRING YET: having trouble getting this to type-check and compile +export async function _orgMemberById(orgId: UUID, userId: UUID): Promise> { + //language=GraphQL + const result = await getClient() + .query( + graphql(` + query OrgMemberById($orgId: UUID!, $userId: UUID!}!) { + orgMemberById($orgId, $userId) { + orgMemberDto { + id + name + email + emailVerified + isAdmin + createdDate + username + locked + localizationCode + updatedDate + lastActive + canCreateProjects + } + errors { + __typename + ... on Error { + message + } + } + } + } + `), + { orgId, userId }, + ); + return result; + +} + export async function _changeOrgMemberRole(orgId: string, userId: string, role: OrgRole): $OpResult { //language=GraphQL const result = await getClient()