This commit is contained in:
crusader 2018-02-09 17:05:43 +09:00
parent 003902a858
commit 228bf85676
3 changed files with 34 additions and 3 deletions

View File

@ -3,6 +3,8 @@ import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientModule } from '@angular/common/http';
import { AppRoutingModule } from './app-routing.module';
import { AppReducerModule } from './app-reducer.module';
import { MaterialModule } from './commons/ui/material/material.module';
@ -21,6 +23,7 @@ import { AppComponent } from './app.component';
AppReducerModule,
MaterialModule,
CovalentModule,
HttpClientModule,
],
bootstrap: [AppComponent]
})

View File

@ -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()
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;
}
}

View File

@ -8,7 +8,9 @@ export class MemberService {
public constructor(
private rpcService: RPCService,
) { }
) {
}
public signin(email: string, password: string) {
this.rpcService.call<Member>('MemberService.signin', email, password).subscribe(