Skip to content

Need help to configure #5

@rochapablo

Description

@rochapablo

I'm trying to setup the node-angular-http-client but the requests keep working without cache.

He's my setup, I tried to follow the README but there's something missing and I can't figure it out what it is.

app.module

providers: [
    { provide: HTTP_INTERCEPTORS, useClass: TokenInterceptor, multi: true },
    { provide: HTTP_INTERCEPTORS, useClass: CacheInterceptor, multi: true },

interceptor

@Injectable()
export class CacheInterceptor implements HttpInterceptor {  
  intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
    console.log('CacheInterceptor');
    return next.handle(request);
  }
}

http server

Injectable()
export abstract class BaseService {
  protected env: any = null;
  protected host: string = null;
  constructor(protected http: HttpClient) {
  }
  protected _get(action: string = '', params: string = ''): Observable<Object> {
    return this.http.get(`${this.env.host}}${action}${params}`);
  }
}

user service

@Injectable()
export class UserService extends BaseService {
  env = environment.services.users;
  get() {
    return this._get();
  }
}

Shouldn't the project been import somewhere?

@Maximaximum, do you have any idea about this?

angular: 5.2.0,
node-angular-http-client: 1.1.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions