* rxjs update done
This commit is contained in:
parent
1eccb8de8c
commit
0a16c232d2
5
package-lock.json
generated
5
package-lock.json
generated
@ -8331,11 +8331,6 @@
|
|||||||
"tslib": "^1.9.0"
|
"tslib": "^1.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rxjs-compat": {
|
|
||||||
"version": "6.3.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.3.3.tgz",
|
|
||||||
"integrity": "sha512-caGN7ixiabHpOofginKEquuHk7GgaCrC7UpUQ9ZqGp80tMc68msadOeP/2AKy2R4YJsT1+TX5GZCtxO82qWkyA=="
|
|
||||||
},
|
|
||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.2",
|
"version": "5.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||||
|
|||||||
@ -26,8 +26,7 @@
|
|||||||
"core-js": "^2.5.4",
|
"core-js": "^2.5.4",
|
||||||
"jquery": "^3.3.1",
|
"jquery": "^3.3.1",
|
||||||
"rxjs": "~6.3.3",
|
"rxjs": "~6.3.3",
|
||||||
"zone.js": "~0.8.26",
|
"zone.js": "~0.8.26"
|
||||||
"rxjs-compat": "^6.0.0-rc.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "~0.10.0",
|
"@angular-devkit/build-angular": "~0.10.0",
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { AuthService } from "./auth/auth.service";
|
import { AuthService } from "./auth/auth.service";
|
||||||
import { Subscription } from "rxjs/Subscription";
|
|
||||||
import { TimerObservable } from "rxjs/observable/TimerObservable";
|
|
||||||
|
|
||||||
import { FaultManagerService } from "./fault-manager/fault-manager.service";
|
import { FaultManagerService } from "./fault-manager/fault-manager.service";
|
||||||
|
import { Subscription, timer } from "rxjs";
|
||||||
|
|
||||||
// timers are in milliseconds
|
// timers are in milliseconds
|
||||||
const RENEW_TIMER_INITIAL = 300000; // 5min
|
const RENEW_TIMER_INITIAL = 300000; // 5min
|
||||||
@ -25,14 +24,14 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
private faultManager: FaultManagerService) {}
|
private faultManager: FaultManagerService) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
let authRenewObservable = TimerObservable.create(RENEW_TIMER_INITIAL, RENEW_TIMER_PERIOD);
|
const authRenewObservable = timer(RENEW_TIMER_INITIAL, RENEW_TIMER_PERIOD);
|
||||||
this.authRenewTimer = authRenewObservable.subscribe(() => {
|
this.authRenewTimer = authRenewObservable.subscribe(() => {
|
||||||
if (this.authService.isLoggedIn) {
|
if (this.authService.isLoggedIn) {
|
||||||
this.authService.renew();
|
this.authService.renew();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let faultReloadObservable = TimerObservable.create(FAULT_RELOAD_PERIOD, FAULT_RELOAD_PERIOD);
|
const faultReloadObservable = timer(FAULT_RELOAD_PERIOD, FAULT_RELOAD_PERIOD);
|
||||||
this.faultReloadTimer = faultReloadObservable.subscribe(() => {
|
this.faultReloadTimer = faultReloadObservable.subscribe(() => {
|
||||||
if (this.authService.isLoggedIn) {
|
if (this.authService.isLoggedIn) {
|
||||||
this.faultManager.list().subscribe(faults => this.faultManager.faults = faults);
|
this.faultManager.list().subscribe(faults => this.faultManager.faults = faults);
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Router } from "@angular/router";
|
import { Router } from "@angular/router";
|
||||||
import { HttpClient } from "@angular/common/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
import 'rxjs/Rx';
|
|
||||||
import { JwtHelperService } from '@auth0/angular-jwt';
|
import { JwtHelperService } from '@auth0/angular-jwt';
|
||||||
|
|
||||||
import { environment } from '../../environments/environment';
|
import { environment } from '../../environments/environment';
|
||||||
@ -88,4 +87,4 @@ export class AuthService {
|
|||||||
class AuthResponse {
|
class AuthResponse {
|
||||||
public message: string;
|
public message: string;
|
||||||
public token: string;
|
public token: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Title } from "@angular/platform-browser";
|
import { Title } from "@angular/platform-browser";
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
|
import { finalize } from 'rxjs/operators';
|
||||||
|
|
||||||
import { environment } from "../../../environments/environment";
|
import { environment } from "../../../environments/environment";
|
||||||
import { FaultManagerService } from "../fault-manager.service";
|
import { FaultManagerService } from "../fault-manager.service";
|
||||||
@ -31,15 +32,15 @@ export class ConfirmExpensiveFaultComponent implements OnInit {
|
|||||||
|
|
||||||
public confirm() {
|
public confirm() {
|
||||||
this.submitInProgress = true;
|
this.submitInProgress = true;
|
||||||
this.faultManager.confirmFault(this.fault)
|
this.faultManager.confirmFault(this.fault).pipe(
|
||||||
.finally(() => this.submitInProgress = false)
|
finalize(() => this.submitInProgress = false))
|
||||||
.subscribe(() => this.router.navigate(['/hiba/feladat-lista']));
|
.subscribe(() => this.router.navigate(['/hiba/feladat-lista']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public reject() {
|
public reject() {
|
||||||
this.submitInProgress = true;
|
this.submitInProgress = true;
|
||||||
this.faultManager.reject(this.fault, 'rej', this.rejectReason)
|
this.faultManager.reject(this.fault, 'rej', this.rejectReason).pipe(
|
||||||
.finally(() => this.submitInProgress = false)
|
finalize(() => this.submitInProgress = false))
|
||||||
.subscribe(() => this.router.navigate(['/hiba/feladat-lista']));
|
.subscribe(() => this.router.navigate(['/hiba/feladat-lista']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||||
import { Title } from "@angular/platform-browser";
|
import { Title } from "@angular/platform-browser";
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
|
import { finalize } from 'rxjs/operators';
|
||||||
|
|
||||||
import { environment } from "../../../environments/environment";
|
import { environment } from "../../../environments/environment";
|
||||||
import { FaultManagerService } from "../fault-manager.service";
|
import { FaultManagerService } from "../fault-manager.service";
|
||||||
@ -61,16 +62,16 @@ export class ConfirmFaultComponent implements OnInit {
|
|||||||
public confirm() {
|
public confirm() {
|
||||||
this.submitInProgress = true;
|
this.submitInProgress = true;
|
||||||
// this.fault.costEstimate = this.costEstimate;
|
// this.fault.costEstimate = this.costEstimate;
|
||||||
this.faultManager.confirmFault(this.fault)
|
this.faultManager.confirmFault(this.fault).pipe(
|
||||||
.finally(() => this.submitInProgress = false)
|
finalize(() => this.submitInProgress = false))
|
||||||
.subscribe(() => this.router.navigate(['/hiba/feladat-lista']));
|
.subscribe(() => this.router.navigate(['/hiba/feladat-lista']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public setHighExpenseFault() {
|
public setHighExpenseFault() {
|
||||||
this.submitInProgress = true;
|
this.submitInProgress = true;
|
||||||
// this.fault.costEstimate = this.costEstimate;
|
// this.fault.costEstimate = this.costEstimate;
|
||||||
this.faultManager.setHighExpenseFault(this.fault)
|
this.faultManager.setHighExpenseFault(this.fault).pipe(
|
||||||
.finally(() => this.submitInProgress = false)
|
finalize(() => this.submitInProgress = false))
|
||||||
.subscribe(fault => {
|
.subscribe(fault => {
|
||||||
this.faultManager.attachPdf(this.fault.id, this.pdfUpload.nativeElement.files).subscribe(
|
this.faultManager.attachPdf(this.fault.id, this.pdfUpload.nativeElement.files).subscribe(
|
||||||
attRes => this.router.navigate(['/hiba/feladat-lista']),
|
attRes => this.router.navigate(['/hiba/feladat-lista']),
|
||||||
@ -81,8 +82,8 @@ export class ConfirmFaultComponent implements OnInit {
|
|||||||
|
|
||||||
public attachImages() {
|
public attachImages() {
|
||||||
this.submitInProgress = true;
|
this.submitInProgress = true;
|
||||||
this.faultManager.attachImages(this.fault.id, this.photoUpload.nativeElement.files)
|
this.faultManager.attachImages(this.fault.id, this.photoUpload.nativeElement.files).pipe(
|
||||||
.finally(() => this.submitInProgress = false)
|
finalize(() => this.submitInProgress = false))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
attRes => this.photoUpload.nativeElement.value = null,
|
attRes => this.photoUpload.nativeElement.value = null,
|
||||||
attErr => alert("Hiba történt a képfeltöltés közben.")
|
attErr => alert("Hiba történt a képfeltöltés közben.")
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from "rxjs";
|
||||||
import { HttpClient, HttpHeaders, HttpRequest } from "@angular/common/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
|
|
||||||
import { environment } from "../../environments/environment";
|
import { environment } from "../../environments/environment";
|
||||||
import { Fault } from "./shared/fault";
|
import { Fault } from "./shared/fault";
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from "@angular/router";
|
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from "@angular/router";
|
||||||
import { HttpClient } from "@angular/common/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
import { Fault } from "./shared/fault";
|
import { Fault } from "./shared/fault";
|
||||||
import { environment } from "../../environments/environment";
|
import { environment } from "../../environments/environment";
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, Resolve } from "@angular/router";
|
import { ActivatedRouteSnapshot, Resolve } from "@angular/router";
|
||||||
import { HttpClient } from "@angular/common/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from "rxjs";
|
||||||
import 'rxjs/Rx';
|
|
||||||
|
|
||||||
import { environment } from "../../../environments/environment";
|
import { environment } from "../../../environments/environment";
|
||||||
import { ErrorCategory } from "../shared";
|
import { ErrorCategory } from "../shared";
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, Resolve } from "@angular/router";
|
import { ActivatedRouteSnapshot, Resolve } from "@angular/router";
|
||||||
import { HttpClient } from "@angular/common/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from "rxjs";
|
||||||
import 'rxjs/Rx';
|
|
||||||
|
|
||||||
import { environment } from "../../../environments/environment";
|
import { environment } from "../../../environments/environment";
|
||||||
import { ErrorOrigin } from "../shared/error-origin";
|
import { ErrorOrigin } from "../shared";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ErrorOriginService implements Resolve<false|Array<ErrorOrigin>> {
|
export class ErrorOriginService implements Resolve<false|Array<ErrorOrigin>> {
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, Resolve } from "@angular/router";
|
import { ActivatedRouteSnapshot, Resolve } from "@angular/router";
|
||||||
import { HttpClient } from "@angular/common/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from "rxjs";
|
||||||
import 'rxjs/Rx';
|
|
||||||
|
|
||||||
import { environment } from "../../../environments/environment";
|
import { environment } from "../../../environments/environment";
|
||||||
import { FacilityLocation } from "../shared";
|
import { FacilityLocation } from "../shared";
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, Resolve } from "@angular/router";
|
import { ActivatedRouteSnapshot, Resolve } from "@angular/router";
|
||||||
import { HttpClient } from "@angular/common/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from "rxjs";
|
||||||
import 'rxjs/Rx';
|
|
||||||
|
|
||||||
import { environment } from "../../../environments/environment";
|
import { environment } from "../../../environments/environment";
|
||||||
import { SolutionTimeInterval } from "../shared/solution-time-interval";
|
import { SolutionTimeInterval } from "../shared";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SolutionTimeIntervalService implements Resolve<false|Array<SolutionTimeInterval>> {
|
export class SolutionTimeIntervalService implements Resolve<false|Array<SolutionTimeInterval>> {
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
import {finalize} from 'rxjs/operators';
|
||||||
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||||
import { ActivatedRoute } from "@angular/router";
|
import { ActivatedRoute } from "@angular/router";
|
||||||
import { Title } from "@angular/platform-browser";
|
import { Title } from "@angular/platform-browser";
|
||||||
@ -83,8 +85,8 @@ export class ReadonlyDisplayComponent implements OnInit {
|
|||||||
|
|
||||||
public attachImages() {
|
public attachImages() {
|
||||||
this.submitInProgress = true;
|
this.submitInProgress = true;
|
||||||
this.faultManager.attachImages(this.fault.id, this.photoUpload.nativeElement.files)
|
this.faultManager.attachImages(this.fault.id, this.photoUpload.nativeElement.files).pipe(
|
||||||
.finally(() => this.submitInProgress = false)
|
finalize(() => this.submitInProgress = false))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
attRes => this.photoUpload.nativeElement.value = null,
|
attRes => this.photoUpload.nativeElement.value = null,
|
||||||
attErr => alert("Hiba történt a képfeltöltés közben.")
|
attErr => alert("Hiba történt a képfeltöltés közben.")
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
import {finalize} from 'rxjs/operators';
|
||||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
import { ErrorCategory } from "../shared/error-category";
|
import { ErrorCategory } from "../shared/error-category";
|
||||||
@ -91,9 +93,9 @@ export class RecordFaultComponent implements OnInit, AfterViewInit {
|
|||||||
};
|
};
|
||||||
this.faultService.create(fault).subscribe(fault => {
|
this.faultService.create(fault).subscribe(fault => {
|
||||||
if (this.photoUpload.nativeElement.files.length > 0) {
|
if (this.photoUpload.nativeElement.files.length > 0) {
|
||||||
this.faultService.attachImages(fault.id, this.photoUpload.nativeElement.files).finally(
|
this.faultService.attachImages(fault.id, this.photoUpload.nativeElement.files).pipe(finalize(
|
||||||
() => this.submitInProgress = false
|
() => this.submitInProgress = false
|
||||||
).subscribe(
|
)).subscribe(
|
||||||
attRes => this.router.navigate(['/hiba/feladat-lista']),
|
attRes => this.router.navigate(['/hiba/feladat-lista']),
|
||||||
attErr => {
|
attErr => {
|
||||||
console.log("File upload error");
|
console.log("File upload error");
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
import {finalize} from 'rxjs/operators';
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { environment } from "../../../environments/environment";
|
import { environment } from "../../../environments/environment";
|
||||||
import { Fault } from "../shared/fault";
|
import { Fault } from "../shared/fault";
|
||||||
@ -30,15 +32,15 @@ export class RepairCompleteComponent implements OnInit {
|
|||||||
|
|
||||||
public confirm() {
|
public confirm() {
|
||||||
this.submitInProgress = true;
|
this.submitInProgress = true;
|
||||||
this.faultManager.acknowledgeRepair(this.fault)
|
this.faultManager.acknowledgeRepair(this.fault).pipe(
|
||||||
.finally(() => this.submitInProgress = false)
|
finalize(() => this.submitInProgress = false))
|
||||||
.subscribe(() => this.router.navigate(['/hiba/feladat-lista']));
|
.subscribe(() => this.router.navigate(['/hiba/feladat-lista']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public reject() {
|
public reject() {
|
||||||
this.submitInProgress = true;
|
this.submitInProgress = true;
|
||||||
this.faultManager.reject(this.fault, 'cnf', this.rejectReason)
|
this.faultManager.reject(this.fault, 'cnf', this.rejectReason).pipe(
|
||||||
.finally(() => this.submitInProgress = false)
|
finalize(() => this.submitInProgress = false))
|
||||||
.subscribe(() => this.router.navigate(['/hiba/feladat-lista']));
|
.subscribe(() => this.router.navigate(['/hiba/feladat-lista']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
import {finalize} from 'rxjs/operators';
|
||||||
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||||
import { Title } from "@angular/platform-browser";
|
import { Title } from "@angular/platform-browser";
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
@ -78,8 +80,8 @@ export class RepairFaultComponent implements OnInit {
|
|||||||
|
|
||||||
public addComment() {
|
public addComment() {
|
||||||
this.submitInProgress = true;
|
this.submitInProgress = true;
|
||||||
this.faultManager.addComment(this.fault.id, this.comment.trim())
|
this.faultManager.addComment(this.fault.id, this.comment.trim()).pipe(
|
||||||
.finally(() => this.submitInProgress = false)
|
finalize(() => this.submitInProgress = false))
|
||||||
.subscribe(fault => {
|
.subscribe(fault => {
|
||||||
this.fault = fault;
|
this.fault = fault;
|
||||||
this.comments = fault.comments.reverse();
|
this.comments = fault.comments.reverse();
|
||||||
@ -89,8 +91,8 @@ export class RepairFaultComponent implements OnInit {
|
|||||||
|
|
||||||
public attachImages() {
|
public attachImages() {
|
||||||
this.submitInProgress = true;
|
this.submitInProgress = true;
|
||||||
this.faultManager.attachImages(this.fault.id, this.photoUpload.nativeElement.files)
|
this.faultManager.attachImages(this.fault.id, this.photoUpload.nativeElement.files).pipe(
|
||||||
.finally(() => this.submitInProgress = false)
|
finalize(() => this.submitInProgress = false))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
attRes => this.photoUpload.nativeElement.value = null,
|
attRes => this.photoUpload.nativeElement.value = null,
|
||||||
attErr => alert("Hiba történt a képfeltöltés közben.")
|
attErr => alert("Hiba történt a képfeltöltés közben.")
|
||||||
@ -99,8 +101,8 @@ export class RepairFaultComponent implements OnInit {
|
|||||||
|
|
||||||
public confirmRepair() {
|
public confirmRepair() {
|
||||||
this.submitInProgress = true;
|
this.submitInProgress = true;
|
||||||
this.faultManager.repairDone(this.fault)
|
this.faultManager.repairDone(this.fault).pipe(
|
||||||
.finally(() => this.submitInProgress = false)
|
finalize(() => this.submitInProgress = false))
|
||||||
.subscribe(() => this.router.navigate(['/hiba/feladat-lista']));
|
.subscribe(() => this.router.navigate(['/hiba/feladat-lista']));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,11 +168,11 @@ export class RepairFaultComponent implements OnInit {
|
|||||||
|
|
||||||
saveWorkData() {
|
saveWorkData() {
|
||||||
this.submitInProgress = true;
|
this.submitInProgress = true;
|
||||||
this.faultManager.update(this.fault)
|
this.faultManager.update(this.fault).pipe(
|
||||||
.finally(() => {
|
finalize(() => {
|
||||||
this.submitInProgress = false;
|
this.submitInProgress = false;
|
||||||
this.costChanged = false;
|
this.costChanged = false;
|
||||||
})
|
}))
|
||||||
.subscribe(fault => this.fault = fault);
|
.subscribe(fault => this.fault = fault);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from "rxjs";
|
||||||
import { HttpClient, HttpHeaders, HttpRequest } from "@angular/common/http";
|
import { HttpClient, HttpHeaders, HttpRequest } from "@angular/common/http";
|
||||||
|
|
||||||
import { environment } from "../../environments/environment";
|
import { environment } from "../../environments/environment";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from "@angular/common/http";
|
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from "@angular/common/http";
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class JsonRequestInterceptorService implements HttpInterceptor {
|
export class JsonRequestInterceptorService implements HttpInterceptor {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from "@angular/common/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from "@angular/router";
|
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from "@angular/router";
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
import { environment } from "../../environments/environment";
|
import { environment } from "../../environments/environment";
|
||||||
import { User } from "./shared/user";
|
import { User } from "./shared/user";
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { UserService } from "../user.service";
|
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
import { Title } from "@angular/platform-browser";
|
import { Title } from "@angular/platform-browser";
|
||||||
|
import { finalize } from 'rxjs/operators';
|
||||||
|
|
||||||
import { User } from "../shared/user";
|
import { User } from "../shared/user";
|
||||||
|
import { UserService } from "../user.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-settings',
|
selector: 'app-settings',
|
||||||
@ -32,8 +34,8 @@ export class SettingsComponent implements OnInit {
|
|||||||
public changePassword() {
|
public changePassword() {
|
||||||
this.submitInProgress=true;
|
this.submitInProgress=true;
|
||||||
if (this.user.canChangePassword) {
|
if (this.user.canChangePassword) {
|
||||||
this.userService.changeOwnPassword(this.oldPassword, this.newPassword)
|
this.userService.changeOwnPassword(this.oldPassword, this.newPassword).pipe(
|
||||||
.finally(()=>this.submitInProgress=false)
|
finalize(()=>this.submitInProgress=false))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
ok => {
|
ok => {
|
||||||
if (ok) {
|
if (ok) {
|
||||||
@ -54,7 +56,7 @@ export class SettingsComponent implements OnInit {
|
|||||||
this.submitInProgress=true;
|
this.submitInProgress=true;
|
||||||
this.userService.changeSettings({
|
this.userService.changeSettings({
|
||||||
wantsEmail: this.user.wantsEmail
|
wantsEmail: this.user.wantsEmail
|
||||||
}).finally(()=>this.submitInProgress=false)
|
}).pipe(finalize(()=>this.submitInProgress=false))
|
||||||
.subscribe(okResult => this.router.navigate(['/']));
|
.subscribe(okResult => this.router.navigate(['/']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from "@angular/common/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from "@angular/router";
|
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from "@angular/router";
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
import { environment } from "../../environments/environment";
|
import { environment } from "../../environments/environment";
|
||||||
import { User } from "./shared/user";
|
import { User } from "./shared/user";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user