From ccdcb1e3ce4c183c5f4585ea7481184726375a59 Mon Sep 17 00:00:00 2001 From: William Newman <3382274+newmanw@users.noreply.github.com> Date: Thu, 5 Sep 2024 07:34:28 -0600 Subject: [PATCH] Fix duplicate call to myself --- .../src/app/map/controls/export.component.html | 2 +- web-app/src/app/user/user.service.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/web-app/src/app/map/controls/export.component.html b/web-app/src/app/map/controls/export.component.html index e93e7bcec..0d7aa39ca 100644 --- a/web-app/src/app/map/controls/export.component.html +++ b/web-app/src/app/map/controls/export.component.html @@ -1,3 +1,3 @@ - diff --git a/web-app/src/app/user/user.service.ts b/web-app/src/app/user/user.service.ts index 1452cd7c7..5cc0fe7fc 100644 --- a/web-app/src/app/user/user.service.ts +++ b/web-app/src/app/user/user.service.ts @@ -1,7 +1,7 @@ import { HttpClient, HttpContext, HttpEvent } from '@angular/common/http' import { Injectable } from '@angular/core' import { Router } from '@angular/router' -import { Observable, Subject } from 'rxjs' +import { Observable, Subject, tap } from 'rxjs' import { LocalStorageService } from '../http/local-storage.service' import { BYPASS_TOKEN } from '../http/token.interceptor' import { User } from 'core-lib-src/user' @@ -96,13 +96,13 @@ export class UserService { } getMyself(): Observable { - const observable = this.httpClient.get('/api/users/myself') - - observable.subscribe((user: any) => { - this.setUser(user) - }) - - return observable + return this.httpClient + .get('/api/users/myself') + .pipe( + tap((user: any) => { + this.setUser(user) + }), + ) } setUser(user: any) {