Browse Source

Refactoring

pull/7175/head
Thomas Kaul 2 weeks ago
parent
commit
d3659d7239
  1. 10
      apps/client/src/app/services/web-authn.service.ts

10
apps/client/src/app/services/web-authn.service.ts

@ -42,12 +42,12 @@ export class WebAuthnService {
console.warn('Could not register device', error); console.warn('Could not register device', error);
return of(null); return of(null);
}), }),
switchMap((attOps) => { switchMap((registrationOptions) => {
if (!attOps) { if (!registrationOptions) {
throw new Error('Could not generate registration options'); throw new Error('Could not generate registration options');
} }
return startRegistration({ optionsJSON: attOps }); return startRegistration({ optionsJSON: registrationOptions });
}), }),
switchMap((credential) => { switchMap((credential) => {
return this.http.post<AuthDeviceDto>( return this.http.post<AuthDeviceDto>(
@ -55,10 +55,10 @@ export class WebAuthnService {
{ credential } { credential }
); );
}), }),
tap((authDevice) => tap(({ id }) =>
this.settingsStorageService.setSetting( this.settingsStorageService.setSetting(
WebAuthnService.WEB_AUTH_N_DEVICE_ID, WebAuthnService.WEB_AUTH_N_DEVICE_ID,
authDevice.id id
) )
) )
); );

Loading…
Cancel
Save