Suppression de l'input 'refresh' et refactoring
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Component, AfterContentChecked, OnInit, OnDestroy } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ActivatedRoute, Router, RouterLink, RouterModule } from '@angular/router';
|
||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
@@ -11,10 +11,8 @@ import { Observable, Subscription } from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { MenuItems, JumpAddDialogComponent, JumpTableComponent } from 'src/app/components/shared';
|
||||
//import { JumpTableComponent } from 'src/app/components/shared/helpers-jump';
|
||||
import { Errors, Jump, JumpAddParams, JumpListConfig, User } from 'src/app/core/models';
|
||||
import { Errors, Jump, JumpListConfig, User } from 'src/app/core/models';
|
||||
import { JumpsService, JumpTableService, UserService } from 'src/app/core/services';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import data from 'src/jumps.json';
|
||||
//import data from 'src/jumps_02.json';
|
||||
|
||||
@@ -41,7 +39,6 @@ export class LogbookComponent implements OnInit, OnDestroy, AfterContentChecked
|
||||
public lastJump: Jump = {} as Jump;
|
||||
public currentUser: User = {} as User;
|
||||
public listConfig: JumpListConfig = { type: 'all', filters: {} };
|
||||
public refresh: boolean = false;
|
||||
public isAuthenticated = false;
|
||||
public isUser = true;
|
||||
public canModify = false;
|
||||
@@ -103,7 +100,6 @@ export class LogbookComponent implements OnInit, OnDestroy, AfterContentChecked
|
||||
try {
|
||||
data.forEach((entry) => {
|
||||
Object.assign(this.jump, entry);
|
||||
//console.log(this.jump);
|
||||
this._jumpsService.save(this.jump)
|
||||
.pipe(take(1))
|
||||
.subscribe({
|
||||
@@ -152,7 +148,6 @@ export class LogbookComponent implements OnInit, OnDestroy, AfterContentChecked
|
||||
}
|
||||
|
||||
private _saveJump(jump: Jump, refresh: boolean) {
|
||||
//console.log(jump);
|
||||
this._jumpsService.save(jump)
|
||||
.pipe(take(1))
|
||||
.subscribe({
|
||||
@@ -162,7 +157,6 @@ export class LogbookComponent implements OnInit, OnDestroy, AfterContentChecked
|
||||
if (refresh) {
|
||||
this.jumpRefresh = !this.jumpRefresh;
|
||||
this._jumpTableService.updateJumpRefresh(this.jumpRefresh);
|
||||
//this.refresh = !this.refresh;
|
||||
this._lastjump$ = this._jumpsService.getLastJump();
|
||||
this._lastjump = this._lastjump$.subscribe((jump) => {
|
||||
this.lastJump = jump;
|
||||
|
||||
Reference in New Issue
Block a user