Skip to content

Instantly share code, notes, and snippets.

View DMezhenskyi's full-sized avatar

Dmytro Mezhenskyi DMezhenskyi

View GitHub Profile
born2net / ngrx8_with_immer.ts
Created July 10, 2019 14:55
ngrx 8+ with immer and support for on() within reducer
import {createReducer} from '@ngrx/store';
import {on} from "@ngrx/store";
import produce, {Draft} from "immer";
export const initialUserState: IUserState = {
knownUsers: [user1, user2],
selectedUser: null,
scenes: null
gund /
Last active September 19, 2022 01:08
Concept of Http Interceptor for Angular 2

First, we need to define interfaces with which we will work:

export interface Interceptable<T extends Interceptor<any, any>> {
  addInterceptor(interceptor: T): Interceptable<T>;
  removeInterceptor(interceptor: T): Interceptable<T>;
  clearInterceptors(interceptors?: T[]): Interceptable<T>;

export interface Interceptor<T, D> {