Skip to content

Commit

Permalink
Merge pull request #1057 from ORCID/remove-unneeded-constants
Browse files Browse the repository at this point in the history
remove unnecessary constants
bobcaprice authored Nov 9, 2023
2 parents f02cd3d + c8c060b commit 28cb6e1
Showing 4 changed files with 4 additions and 18 deletions.
3 changes: 1 addition & 2 deletions ui/src/app/account/service/account.service.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@ import { SessionStorageService } from 'ngx-webstorage'
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http'
import { BehaviorSubject, EMPTY, Observable, Subject, catchError, map, of, takeUntil, tap } from 'rxjs'

Check warning on line 4 in ui/src/app/account/service/account.service.ts

GitHub Actions / format

'of' is defined but never used

Check warning on line 4 in ui/src/app/account/service/account.service.ts

GitHub Actions / format

'tap' is defined but never used

import { SERVER_API_URL } from '../../../app/app.constants'
import { IAccount } from '../model/account.model'
// TODO: uncomment when memberservice is added or change the account service so that this logic is absent from the account service
//import { MSMemberService } from 'app/entities/member/member.service';
@@ -15,7 +14,7 @@ export class AccountService {
private stopFetchingAccountData = new Subject()
private authenticated = false
private authenticationState = new BehaviorSubject<any>(null)

Check warning on line 16 in ui/src/app/account/service/account.service.ts

GitHub Actions / format

Unexpected any. Specify a different type
private logoutAsResourceUrl = SERVER_API_URL + 'services/userservice/api'
private logoutAsResourceUrl = '/services/userservice/api'

constructor(
// TODO: uncomment when language service is implemented
4 changes: 0 additions & 4 deletions ui/src/app/app.constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
export const SERVER_API_URL = 'http://localhost:4200'

export const VERSION = 'test-ui'

export enum EventType {
LOG_IN_SUCCESS = 'LOG_IN_SUCCESS',
AFFILIATION_CREATED = 'AFFILIATION_CREATED',
10 changes: 2 additions & 8 deletions ui/src/app/layout/navbar/navbar.component.ts
Original file line number Diff line number Diff line change
@@ -14,23 +14,18 @@ import {
faLock,
} from '@fortawesome/free-solid-svg-icons'
import { HttpResponse, HttpErrorResponse } from '@angular/common/http'
import { Observable } from 'rxjs'
import { SERVER_API_URL, VERSION } from '../../../app/app.constants'
import { AccountService, LoginService } from '../../account'
import { MemberService } from 'src/app/member/service/member.service'
import { IAccount } from 'src/app/account/model/account.model'
import { IMember } from 'src/app/member/model/member.model'

type EntityResponseType = HttpResponse<IMember>

@Component({
selector: 'app-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.scss'],
})
export class NavbarComponent implements OnInit {
isNavbarCollapsed: boolean
version: string

organizationName: string | undefined
account: IAccount | undefined
@@ -56,7 +51,6 @@ export class NavbarComponent implements OnInit {
private memberService: MemberService,
private router: Router
) {
this.version = VERSION ? 'v' + VERSION : ''
this.isNavbarCollapsed = true
}

@@ -121,7 +115,7 @@ export class NavbarComponent implements OnInit {
this.userName = undefined
if (this.isLoggedAs()) {
this.accountService.logoutAs().subscribe(() => {
window.location.href = SERVER_API_URL
window.location.href = '/'
})
} else {
this.memberService.setManagedMember(null)
@@ -137,7 +131,7 @@ export class NavbarComponent implements OnInit {
this.memberCallDone = false
this.userName = undefined
this.accountService.logoutAs().subscribe((res) => {
window.location.href = SERVER_API_URL
window.location.href = '/'
})
}

5 changes: 1 addition & 4 deletions ui/src/app/member/service/member.service.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ import { Injectable } from '@angular/core'
import { BehaviorSubject, Observable, of, map, catchError } from 'rxjs'
import { HttpClient, HttpResponse } from '@angular/common/http'
import { IMember } from '../model/member.model'
import { SERVER_API_URL } from 'src/app/app.constants'
import * as moment from 'moment'

type EntityResponseType = HttpResponse<IMember>
@@ -11,7 +10,7 @@ type EntityResponseType = HttpResponse<IMember>
export class MemberService {
constructor(protected http: HttpClient) {}

public resourceUrl = SERVER_API_URL + '/services/memberservice/api'
public resourceUrl = '/services/memberservice/api'
public managedMember = new BehaviorSubject<string | null>(null)

find(id: string): Observable<IMember | null> {
@@ -36,8 +35,6 @@ export class MemberService {
}

protected convertDateFromServer(res: EntityResponseType): IMember | null {
console.log('************************************************* convertDateFromServer')

if (res.body) {
res.body.createdDate = res.body.createdDate != null ? moment(res.body.createdDate) : undefined
res.body.lastModifiedDate = res.body.lastModifiedDate != null ? moment(res.body.lastModifiedDate) : undefined

0 comments on commit 28cb6e1

Please sign in to comment.