Skip to content

Commit

Permalink
Fix adminAdpi.loginUser method
Browse files Browse the repository at this point in the history
  • Loading branch information
ba1uev committed Jan 18, 2024
1 parent 7630cc8 commit 97d33b0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/admin-api/index.ts
Expand Up @@ -140,13 +140,11 @@ class AdminApi {
return rooms
}

async loginUser(userId: string): Promise<LoginUserResponse | null> {
async loginUser(userId: string, validUnitlMs?: number): Promise<LoginUserResponse | null> {
try {
return (await this.makeRequest("GET", `/v1/users/${userId}/login`)) as LoginUserResponse
const payload = validUnitlMs ? { valid_until_ms: validUnitlMs } : undefined
return (await this.makeRequest("POST", `/v1/users/${userId}/login`, payload)) as LoginUserResponse
} catch (err) {
if (err.response.status === 404) {
return null
}
throw err
}
}
Expand Down

0 comments on commit 97d33b0

Please sign in to comment.