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) {
return API.updateUserInvite(invite)
return API.updateUserInvite(invite.code, invite)
}
async function create(data) {

View File

@ -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<AccountMetadata | null>
// Missing request or response types
searchUsers: (data: SearchUsersRequest) => Promise<any>
searchUsers: (data: SearchUsersRequest) => Promise<SearchUsersResponse>
createUsers: (
users: User[],
groups: any[]
) => Promise<BulkUserCreated | undefined>
updateUserInvite: (data: any) => Promise<any>
updateUserInvite: (
code: string,
data: UpdateInviteRequest
) => Promise<UpdateInviteResponse>
}
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<SearchUsersRequest, any>({
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<UpdateInviteRequest, UpdateInviteResponse>({
url: `/api/global/users/invite/update/${code}`,
body: data,
})
},