-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Subscribe executing twice times.
I'm having problems to use the library with HttpClient because when I call the subscribe, the method returns a result from Options request and after the result from GET,POST,PUT,DELETE request. And this behavior doesn't happen when I user the HttpClient directly.
I'm really want to continue using your library because It's one that already uses HttpClient and now I'm having a necessity to use the HttpInterceptors in my project. Before this, I was using https://www.npmjs.com/package/ng2-http but they don't have global interceptors support yet.
When I use raw HttpClient like this, the result of subscribe is correct.
let post = this.http.post(apiEndpoint + 'core/company/find-user-companies', this.model, { headers: new HttpHeaders().set('Content-Type', 'application/json') }); post.subscribe((res) => { console.log('COMPANY SEM LIB', res); });
But when I use the Library, the result is first undefined and after the correct response.
`@Injectable()
export class CompanyService extends RestClient {
constructor(http: HttpClient) {
super(http);
}
@Post('/company/find-user-companies')
@Produces(MediaType.JSON)
public findUserCompanies(@Body credentials: any): Observable<Company[]> {
return null;
}
...
}`