ing
This commit is contained in:
parent
003902a858
commit
228bf85676
|
@ -3,6 +3,8 @@ import { NgModule } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
|
|
||||||
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
|
|
||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
import { AppReducerModule } from './app-reducer.module';
|
import { AppReducerModule } from './app-reducer.module';
|
||||||
import { MaterialModule } from './commons/ui/material/material.module';
|
import { MaterialModule } from './commons/ui/material/material.module';
|
||||||
|
@ -21,6 +23,7 @@ import { AppComponent } from './app.component';
|
||||||
AppReducerModule,
|
AppReducerModule,
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
CovalentModule,
|
CovalentModule,
|
||||||
|
HttpClientModule,
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,8 +1,34 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable, Inject } from '@angular/core';
|
||||||
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
import 'rxjs/add/operator/do';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RESTService {
|
export class RESTService {
|
||||||
|
private baseURL: string;
|
||||||
|
|
||||||
constructor() { }
|
constructor(
|
||||||
|
@Inject(HttpClient) private httpClient: HttpClient,
|
||||||
|
) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public get<T>(entry: string, ...args: any[]): Observable<T> {
|
||||||
|
const headers: HttpHeaders = new HttpHeaders();
|
||||||
|
headers
|
||||||
|
.set('Accept', 'application/json')
|
||||||
|
.set('Content-Type', 'application/json');
|
||||||
|
|
||||||
|
this.httpClient
|
||||||
|
.get<T>('')
|
||||||
|
.do(
|
||||||
|
(data: any) => {
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,9 @@ export class MemberService {
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
private rpcService: RPCService,
|
private rpcService: RPCService,
|
||||||
) { }
|
) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public signin(email: string, password: string) {
|
public signin(email: string, password: string) {
|
||||||
this.rpcService.call<Member>('MemberService.signin', email, password).subscribe(
|
this.rpcService.call<Member>('MemberService.signin', email, password).subscribe(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user