Skip to content

Commit 6985c61

Browse files
committed
fix: check for undefined validatePromise
Signed-off-by: Benjamin Frueh <benjamin.frueh@gmail.com>
1 parent b1be655 commit 6985c61

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/password-confirmation.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function addPasswordConfirmationInterceptors(axios: AxiosInstance): void
9393

9494
INTERCEPTOR_INITIALIZED = true
9595

96-
let validatePromise: PromiseWithResolvers<void>
96+
let validatePromise: PromiseWithResolvers<void> | undefined
9797

9898
axios.interceptors.request.use(async (config) => {
9999
if (config.confirmPassword === undefined) {
@@ -132,7 +132,7 @@ export function addPasswordConfirmationInterceptors(axios: AxiosInstance): void
132132
return response
133133
}
134134

135-
if (!validatePromise) {
135+
if (validatePromise === undefined) {
136136
logger.debug('Password confirmation not required', { response })
137137
return response
138138
}
@@ -148,6 +148,11 @@ export function addPasswordConfirmationInterceptors(axios: AxiosInstance): void
148148
throw error
149149
}
150150

151+
if (validatePromise === undefined) {
152+
logger.debug('Password confirmation not required', { error })
153+
throw error
154+
}
155+
151156
logger.debug('Password confirmation failed', { error })
152157
validatePromise.reject(error)
153158

0 commit comments

Comments
 (0)