From 7ea94788c95dc07b65da401c63f569add46c4c42 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 10 Dec 2024 13:11:53 +0000 Subject: [PATCH] Update user endpoints --- packages/builder/src/stores/portal/users.js | 2 +- packages/frontend-core/src/api/user.ts | 26 ++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/builder/src/stores/portal/users.js b/packages/builder/src/stores/portal/users.js index 7fb073e9e0..88467ac612 100644 --- a/packages/builder/src/stores/portal/users.js +++ b/packages/builder/src/stores/portal/users.js @@ -77,7 +77,7 @@ export function createUsersStore() { } async function updateInvite(invite) { - return API.updateUserInvite(invite) + return API.updateUserInvite(invite.code, invite) } async function create(data) { diff --git a/packages/frontend-core/src/api/user.ts b/packages/frontend-core/src/api/user.ts index 4104dca541..116d4425dc 100644 --- a/packages/frontend-core/src/api/user.ts +++ b/packages/frontend-core/src/api/user.ts @@ -13,6 +13,9 @@ import { InviteUsersResponse, SaveUserResponse, SearchUsersRequest, + SearchUsersResponse, + UpdateInviteRequest, + UpdateInviteResponse, UpdateSelfMetadataRequest, UpdateSelfMetadataResponse, User, @@ -53,14 +56,15 @@ export interface UserEndpoints { appId: string ) => Promise<{ message: string }> getAccountHolder: () => Promise - - // Missing request or response types - searchUsers: (data: SearchUsersRequest) => Promise + searchUsers: (data: SearchUsersRequest) => Promise createUsers: ( users: User[], groups: any[] ) => Promise - updateUserInvite: (data: any) => Promise + updateUserInvite: ( + code: string, + data: UpdateInviteRequest + ) => Promise } export const buildUserEndpoints = (API: BaseAPIClient): UserEndpoints => ({ @@ -77,7 +81,7 @@ export const buildUserEndpoints = (API: BaseAPIClient): UserEndpoints => ({ * Searches a list of users in the current tenant. */ searchUsers: async data => { - return await API.post({ + return await API.post({ url: `/api/global/users/search`, body: data, }) @@ -182,15 +186,11 @@ export const buildUserEndpoints = (API: BaseAPIClient): UserEndpoints => ({ /** * Accepts a user invite as a body and will update the associated app roles. * for an existing invite - * @param invite the invite code sent in the email */ - updateUserInvite: async invite => { - await API.post({ - url: `/api/global/users/invite/update/${invite.code}`, - body: { - apps: invite.apps, - builder: invite.builder, - }, + updateUserInvite: async (code, data) => { + return await API.post({ + url: `/api/global/users/invite/update/${code}`, + body: data, }) },