Skip to content

Commit 60b2918

Browse files
committed
Formatting
1 parent a7b3a57 commit 60b2918

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

packages/auth-compat/src/user_credential.ts

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ function credentialFromResponse(
3131
function attachExtraErrorFields(auth: exp.Auth, e: FirebaseError): void {
3232
// The response contains all fields from the server which may or may not
3333
// actually match the underlying type
34-
const response = ((e.customData as exp.TaggedWithTokenResponse | undefined)
35-
?._tokenResponse as unknown) as Record<string, string>;
34+
const response = (e.customData as exp.TaggedWithTokenResponse | undefined)
35+
?._tokenResponse as unknown as Record<string, string>;
3636
if (e.code === 'auth/multi-factor-auth-required') {
3737
const mfaErr = e as compat.MultiFactorError;
3838
mfaErr.resolver = new MultiFactorResolver(
@@ -54,9 +54,9 @@ function attachExtraErrorFields(auth: exp.Auth, e: FirebaseError): void {
5454
function credentialFromObject(
5555
object: FirebaseError | exp.UserCredential
5656
): exp.AuthCredential | null {
57-
const { _tokenResponse } = (object instanceof FirebaseError
58-
? object.customData
59-
: object) as exp.TaggedWithTokenResponse;
57+
const { _tokenResponse } = (
58+
object instanceof FirebaseError ? object.customData : object
59+
) as exp.TaggedWithTokenResponse;
6060
if (!_tokenResponse) {
6161
return null;
6262
}
@@ -142,26 +142,28 @@ export function convertCredential(
142142
auth: exp.Auth,
143143
credentialPromise: Promise<exp.UserCredential>
144144
): Promise<compat.UserCredential> {
145-
return credentialPromise.catch(e => {
146-
if (e instanceof FirebaseError) {
147-
attachExtraErrorFields(auth, e);
148-
}
149-
throw e;
150-
}).then(credential => {
151-
const operationType = credential.operationType;
152-
const user = credential.user;
153-
154-
return {
155-
operationType,
156-
credential: credentialFromResponse(
157-
credential as exp.UserCredentialInternal
158-
),
159-
additionalUserInfo: exp.getAdditionalUserInfo(
160-
credential as exp.UserCredential
161-
),
162-
user: User.getOrCreate(user)
163-
};
164-
});
145+
return credentialPromise
146+
.catch(e => {
147+
if (e instanceof FirebaseError) {
148+
attachExtraErrorFields(auth, e);
149+
}
150+
throw e;
151+
})
152+
.then(credential => {
153+
const operationType = credential.operationType;
154+
const user = credential.user;
155+
156+
return {
157+
operationType,
158+
credential: credentialFromResponse(
159+
credential as exp.UserCredentialInternal
160+
),
161+
additionalUserInfo: exp.getAdditionalUserInfo(
162+
credential as exp.UserCredential
163+
),
164+
user: User.getOrCreate(user)
165+
};
166+
});
165167
}
166168

167169
export async function convertConfirmationResult(

0 commit comments

Comments
 (0)