member_webapp/src/packages/member/service/member.service.ts

47 lines
1.0 KiB
TypeScript
Raw Normal View History

2018-04-06 06:59:49 +00:00
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import { RESTService } from '@loafer/ng-rest/service';
import { DomainMember } from 'packages/domain/model';
import { Member } from '../model';
@Injectable()
export class MemberService {
public constructor(
private restService: RESTService,
) {
}
public signin(email: string, password: string): Observable<any> {
const body = {
signinId: email,
signinPw: password,
};
return this.restService.request<any>('post', '/account/signin', {
body: body,
});
}
public signin_cookie(authToken: string): Observable<DomainMember> {
const body = {
authToken: authToken,
};
return this.restService.request<DomainMember>('post', '/account/signin_cookie', {
body: body,
});
}
public signup(member: Member): Observable<Member> {
return this.restService.request<Member>('post', '/account/signup', {
body: member,
});
}
}