firstValueFrom instead of toPromise() in account module
This commit is contained in:
parent
13b013c736
commit
b1d2ac55b1
@ -10,6 +10,7 @@ import {
|
||||
NotificationGroupsKeys,
|
||||
NotificationGroupsValues,
|
||||
} from '@red/domain';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-notifications-screen',
|
||||
@ -67,7 +68,7 @@ export class NotificationsScreenComponent implements OnInit {
|
||||
async save() {
|
||||
this._loadingService.start();
|
||||
try {
|
||||
await this._notificationPreferencesService.update(this.formGroup.value).toPromise();
|
||||
await firstValueFrom(this._notificationPreferencesService.update(this.formGroup.value));
|
||||
} catch (e) {
|
||||
this._toaster.error(_('notifications-screen.error.generic'));
|
||||
}
|
||||
@ -87,7 +88,7 @@ export class NotificationsScreenComponent implements OnInit {
|
||||
private async _initializeForm() {
|
||||
this._loadingService.start();
|
||||
|
||||
const notificationPreferences = await this._notificationPreferencesService.get().toPromise();
|
||||
const notificationPreferences = await firstValueFrom(this._notificationPreferencesService.get());
|
||||
this.formGroup.patchValue(notificationPreferences);
|
||||
|
||||
this._loadingService.stop();
|
||||
|
||||
@ -9,6 +9,7 @@ import { PermissionsService } from '@services/permissions.service';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { ConfigService } from '../../../../../services/config.service';
|
||||
import { LanguageService } from '../../../../../i18n/language.service';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-user-profile-screen',
|
||||
@ -76,14 +77,14 @@ export class UserProfileScreenComponent implements OnInit {
|
||||
const value = this.form.getRawValue() as IProfile;
|
||||
delete value.language;
|
||||
|
||||
await this._userService
|
||||
.updateMyProfile({
|
||||
await firstValueFrom(
|
||||
this._userService.updateMyProfile({
|
||||
...value,
|
||||
})
|
||||
.toPromise();
|
||||
}),
|
||||
);
|
||||
|
||||
await this._userService.loadCurrentUser();
|
||||
await this._userService.loadAll().toPromise();
|
||||
await firstValueFrom(this._userService.loadAll());
|
||||
}
|
||||
|
||||
this._initializeForm();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user