|
1 |
| -import { INFO_SAVED_SUCCESSFULLY, INFO_DELETE_SUCCESSFULLY } from './../../shared/messages'; |
2 |
| -import { Injectable } from '@angular/core'; |
3 |
| -import { ofType, Actions, Effect } from '@ngrx/effects'; |
4 |
| -import { Action } from '@ngrx/store'; |
5 |
| -import { of, Observable } from 'rxjs'; |
6 |
| -import { ToastrService } from 'ngx-toastr'; |
7 |
| -import { catchError, map, mergeMap } from 'rxjs/operators'; |
8 |
| -import { EntryService } from '../services/entry.service'; |
| 1 | +import {INFO_SAVED_SUCCESSFULLY, INFO_DELETE_SUCCESSFULLY} from './../../shared/messages'; |
| 2 | +import {Injectable} from '@angular/core'; |
| 3 | +import {ofType, Actions, Effect} from '@ngrx/effects'; |
| 4 | +import {Action} from '@ngrx/store'; |
| 5 | +import {of, Observable} from 'rxjs'; |
| 6 | +import {ToastrService} from 'ngx-toastr'; |
| 7 | +import {catchError, map, mergeMap} from 'rxjs/operators'; |
| 8 | +import {EntryService} from '../services/entry.service'; |
9 | 9 | import * as actions from './entry.actions';
|
10 | 10 |
|
11 | 11 | @Injectable()
|
12 | 12 | export class EntryEffects {
|
13 |
| - constructor(private actions$: Actions, private entryService: EntryService, private toastrService: ToastrService) { } |
| 13 | + constructor(private actions$: Actions, private entryService: EntryService, private toastrService: ToastrService) { |
| 14 | + } |
14 | 15 |
|
15 | 16 | @Effect()
|
16 | 17 | loadEntriesSummary$: Observable<Action> = this.actions$.pipe(
|
@@ -45,7 +46,7 @@ export class EntryEffects {
|
45 | 46 | } else {
|
46 | 47 | const endDate = new Date(activeEntry.start_date);
|
47 | 48 | endDate.setHours(23, 59, 59);
|
48 |
| - return new actions.UpdateActiveEntry({ id: activeEntry.id, end_date: endDate.toISOString() }); |
| 49 | + return new actions.UpdateActiveEntry({id: activeEntry.id, end_date: endDate.toISOString()}); |
49 | 50 | }
|
50 | 51 | }
|
51 | 52 | }),
|
@@ -118,9 +119,7 @@ export class EntryEffects {
|
118 | 119 | mergeMap((entry) =>
|
119 | 120 | this.entryService.updateActiveEntry(entry).pipe(
|
120 | 121 | map((entryResponse) => {
|
121 |
| - if (entryResponse.end_date && entry.start_date === null) { |
122 |
| - this.toastrService.success(INFO_SAVED_SUCCESSFULLY); |
123 |
| - } |
| 122 | + this.toastrService.success(INFO_SAVED_SUCCESSFULLY); |
124 | 123 | return new actions.UpdateActiveEntrySuccess(entryResponse);
|
125 | 124 | }),
|
126 | 125 | catchError((error) => {
|
|
0 commit comments