Skip to content

Commit

Permalink
fix response to addusers to domains
Browse files Browse the repository at this point in the history
Signed-off-by: Musilah <[email protected]>
  • Loading branch information
Musilah committed Apr 4, 2024
1 parent 5914aa5 commit 9167310
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/domains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
type Domain,
type QueryParams,
type DomainsPage,
type Permissions
type Permissions,
type Response
} from './defs'

export default class Domains {
Expand Down Expand Up @@ -248,7 +249,7 @@ export default class Domains {
}
}

public async AddUsertoDomain (domainID: string, userIDs: string[], relation: string, token: string): Promise<any> {
public async AddUsertoDomain (domainID: string, userIDs: string[], relation: string, token: string): Promise<Response> {
// AddUsertoDomain adds user to domain.
const req = { user_ids: userIDs, relation }
const options: RequestInit = {
Expand All @@ -269,13 +270,14 @@ export default class Domains {
const errorRes = await response.json()
throw this.domainError.HandleError(errorRes.error, response.status)
}
return response.statusText
const addResponse: Response = { status: response.status, message: 'User Added Successfully' }
return addResponse
} catch (error) {
throw error
}
}

public async RemoveUserfromDomain (domainID: string, userIDs: string[], relation: string, token: string): Promise<any> {
public async RemoveUserfromDomain (domainID: string, userIDs: string[], relation: string, token: string): Promise<Response> {
// RemoveUserfromDomain removes user from domain.
const req = { user_ids: userIDs, relation }
const options: RequestInit = {
Expand All @@ -296,7 +298,8 @@ export default class Domains {
const errorRes = await response.json()
throw this.domainError.HandleError(errorRes.error, response.status)
}
return response.statusText
const removeResponse: Response = { status: response.status, message: 'User Removed Successfully' }
return removeResponse
} catch (error) {
throw error
}
Expand Down

0 comments on commit 9167310

Please sign in to comment.