Update user endpoints

This commit is contained in:
Andrew Kingston 2024-12-10 13:11:53 +00:00
parent f93f27877f
commit 7ea94788c9
No known key found for this signature in database
2 changed files with 14 additions and 14 deletions

View File

@ -77,7 +77,7 @@ export function createUsersStore() {
} }
async function updateInvite(invite) { async function updateInvite(invite) {
return API.updateUserInvite(invite) return API.updateUserInvite(invite.code, invite)
} }
async function create(data) { async function create(data) {

View File

@ -13,6 +13,9 @@ import {
InviteUsersResponse, InviteUsersResponse,
SaveUserResponse, SaveUserResponse,
SearchUsersRequest, SearchUsersRequest,
SearchUsersResponse,
UpdateInviteRequest,
UpdateInviteResponse,
UpdateSelfMetadataRequest, UpdateSelfMetadataRequest,
UpdateSelfMetadataResponse, UpdateSelfMetadataResponse,
User, User,
@ -53,14 +56,15 @@ export interface UserEndpoints {
appId: string appId: string
) => Promise<{ message: string }> ) => Promise<{ message: string }>
getAccountHolder: () => Promise<AccountMetadata | null> getAccountHolder: () => Promise<AccountMetadata | null>
searchUsers: (data: SearchUsersRequest) => Promise<SearchUsersResponse>
// Missing request or response types
searchUsers: (data: SearchUsersRequest) => Promise<any>
createUsers: ( createUsers: (
users: User[], users: User[],
groups: any[] groups: any[]
) => Promise<BulkUserCreated | undefined> ) => Promise<BulkUserCreated | undefined>
updateUserInvite: (data: any) => Promise<any> updateUserInvite: (
code: string,
data: UpdateInviteRequest
) => Promise<UpdateInviteResponse>
} }
export const buildUserEndpoints = (API: BaseAPIClient): UserEndpoints => ({ 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. * Searches a list of users in the current tenant.
*/ */
searchUsers: async data => { searchUsers: async data => {
return await API.post<SearchUsersRequest, any>({ return await API.post({
url: `/api/global/users/search`, url: `/api/global/users/search`,
body: data, 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. * Accepts a user invite as a body and will update the associated app roles.
* for an existing invite * for an existing invite
* @param invite the invite code sent in the email
*/ */
updateUserInvite: async invite => { updateUserInvite: async (code, data) => {
await API.post({ return await API.post<UpdateInviteRequest, UpdateInviteResponse>({
url: `/api/global/users/invite/update/${invite.code}`, url: `/api/global/users/invite/update/${code}`,
body: { body: data,
apps: invite.apps,
builder: invite.builder,
},
}) })
}, },