clean up and lint files
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
import {Directive, ElementRef, Input, OnInit, TemplateRef, ViewContainerRef} from '@angular/core';
|
||||
import {UserService} from './user.service';
|
||||
|
||||
@Directive({ selector: '[appOwner]', })
|
||||
@Directive({selector: '[appOwner]'})
|
||||
export class OwnerDirective implements OnInit {
|
||||
private currentUserId: string | null = null;
|
||||
private iAppOwner: string | null = null;
|
||||
|
||||
public constructor(private element: ElementRef, private templateRef: TemplateRef<unknown>, private viewContainer: ViewContainerRef, private userService: UserService) {
|
||||
}
|
||||
public constructor(
|
||||
private element: ElementRef,
|
||||
private templateRef: TemplateRef<unknown>,
|
||||
private viewContainer: ViewContainerRef,
|
||||
private userService: UserService
|
||||
) {}
|
||||
|
||||
@Input()
|
||||
public set appOwner(value: string) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import {UserService} from './user.service';
|
||||
import {User} from './user';
|
||||
import {combineLatest} from 'rxjs';
|
||||
|
||||
@Directive({ selector: '[appRole]', })
|
||||
@Directive({selector: '[appRole]'})
|
||||
export class RoleDirective implements OnInit {
|
||||
@Input() public appRole: roles[] = [];
|
||||
private currentUser: User | null = null;
|
||||
@@ -16,9 +16,8 @@ export class RoleDirective implements OnInit {
|
||||
private templateRef: TemplateRef<unknown>,
|
||||
private viewContainer: ViewContainerRef,
|
||||
private userService: UserService,
|
||||
private changeDetection: ChangeDetectorRef,
|
||||
) {
|
||||
}
|
||||
private changeDetection: ChangeDetectorRef
|
||||
) {}
|
||||
|
||||
public ngOnInit(): void {
|
||||
combineLatest([this.userService.user$, this.userService.loggedIn$()]).subscribe(_ => {
|
||||
|
||||
@@ -6,13 +6,11 @@ describe('UserNameComponent', () => {
|
||||
let component: UserNameComponent;
|
||||
let fixture: ComponentFixture<UserNameComponent>;
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
void TestBed.configureTestingModule({
|
||||
imports: [UserNameComponent],
|
||||
}).compileComponents();
|
||||
}),
|
||||
);
|
||||
beforeEach(waitForAsync(() => {
|
||||
void TestBed.configureTestingModule({
|
||||
imports: [UserNameComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(UserNameComponent);
|
||||
|
||||
@@ -2,19 +2,18 @@ import {Component, Input} from '@angular/core';
|
||||
import {UserService} from '../user.service';
|
||||
import {map} from 'rxjs/operators';
|
||||
import {Observable} from 'rxjs';
|
||||
import { AsyncPipe } from '@angular/common';
|
||||
import {AsyncPipe} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-name',
|
||||
templateUrl: './user-name.component.html',
|
||||
styleUrls: ['./user-name.component.less'],
|
||||
imports: [AsyncPipe],
|
||||
selector: 'app-user-name',
|
||||
templateUrl: './user-name.component.html',
|
||||
styleUrls: ['./user-name.component.less'],
|
||||
imports: [AsyncPipe],
|
||||
})
|
||||
export class UserNameComponent {
|
||||
public name$: Observable<string | null> | null = null;
|
||||
|
||||
public constructor(private userService: UserService) {
|
||||
}
|
||||
public constructor(private userService: UserService) {}
|
||||
|
||||
@Input()
|
||||
public set userId(id: string) {
|
||||
|
||||
@@ -22,14 +22,14 @@ export class UserService {
|
||||
private db: DbService,
|
||||
private router: Router,
|
||||
private showDataService: ShowDataService,
|
||||
private showSongDataService: ShowSongDataService,
|
||||
private showSongDataService: ShowSongDataService
|
||||
) {
|
||||
this.afAuth.authState
|
||||
.pipe(
|
||||
filter(auth => !!auth),
|
||||
map(auth => auth?.uid ?? ''),
|
||||
tap(uid => this.iUserId$.next(uid)),
|
||||
switchMap(uid => this.readUser$(uid)),
|
||||
switchMap(uid => this.readUser$(uid))
|
||||
)
|
||||
.subscribe(_ => this.iUser$.next(_));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user