Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 5x 5x 5x 5x 5x 1x | import { createReducer, on } from '@ngrx/store'; import { HttpError } from 'ish-core/models/http-error/http-error.model'; import { setErrorOn, setLoadingOn, unsetLoadingAndErrorOn } from 'ish-core/utils/ngrx-creators'; import { UserBudget } from '../../models/user-budget/user-budget.model'; import { loadBudget, loadBudgetFail, loadBudgetSuccess } from './budget.actions'; export interface BudgetState { budget: UserBudget; loading: boolean; error: HttpError; } const initialState: BudgetState = { loading: false, budget: undefined, error: undefined, }; export const budgetReducer = createReducer( initialState, setLoadingOn(loadBudget), unsetLoadingAndErrorOn(loadBudgetSuccess), setErrorOn(loadBudgetFail), on( loadBudgetSuccess, (state, { payload: { budget } }): BudgetState => ({ ...state, budget, }) ) ); |