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

45 lines
1023 B
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> {
return this.restService.request<any>('post', '/account/signin', {
2018-04-11 06:40:12 +00:00
body: {
2018-04-12 03:03:13 +00:00
signinID: email,
signinPW: password,
2018-04-11 06:40:12 +00:00
},
2018-04-06 06:59:49 +00:00
});
}
public signin_cookie(authToken: string): Observable<DomainMember> {
return this.restService.request<DomainMember>('post', '/account/signin_cookie', {
2018-04-11 06:40:12 +00:00
body: {
authToken: authToken,
},
2018-04-06 06:59:49 +00:00
});
}
public signup(member: Member): Observable<Member> {
return this.restService.request<Member>('post', '/account/signup', {
2018-04-11 06:40:12 +00:00
body: {
member: member,
},
2018-04-06 06:59:49 +00:00
});
}
}