Skip to content

Commit

Permalink
Merge pull request #32 from tfso/bugfix/BB-139
Browse files Browse the repository at this point in the history
throw error if changepassportmap fails #deploy_branch
  • Loading branch information
ffjeanette authored Apr 24, 2024
2 parents 8271688 + 3192aeb commit 816fc00
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Authenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import * as types from './types'
import defaultConfig from './defaultConfig'
import promisify from './promisify'

class HttpError extends Error {
constructor(public status: number, public statusText: string, public headers?: Response["headers"], public body?: Record<string, any>) {
super(`${status} ${statusText}`)
}
}
export class Authenticator{
private _config: types.AuthenticatorConfig
private _baseUrl = `${window.location.protocol}//${window.location.hostname}${window.location.port ? ':' + window.location.port : ''}`
Expand Down Expand Up @@ -191,14 +196,18 @@ export class Authenticator{
}

private async _changePassportMap(data: { ClientId: string; UserId: string }){
return await fetch('/login/data/ChangePassportMap.aspx', {
const res = await fetch('/login/data/ChangePassportMap.aspx', {
method: 'POST',
credentials: 'include',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: mapToWWWEncoded(data)
})
if(!res.ok) {
throw new HttpError(res.status, res.statusText, res.headers)
}
return res
}

private async _removeIdentity() {
Expand Down

0 comments on commit 816fc00

Please sign in to comment.