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

56 lines
1.5 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';
2018-04-30 11:50:47 +00:00
import { RPCService } from '@loafer/ng-rpc/service';
2018-05-02 08:09:39 +00:00
import { DomainMember } from '@overflow/commons-typescript/model/domain';
2018-04-06 06:59:49 +00:00
2018-05-02 08:09:39 +00:00
import { Member } from '@overflow/commons-typescript/model/member';
2018-04-06 06:59:49 +00:00
@Injectable()
export class MemberService {
public constructor(
private restService: RESTService,
2018-04-30 11:50:47 +00:00
private rpcService: RPCService,
2018-04-06 06:59:49 +00:00
) {
}
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
});
}
2018-04-12 08:06:15 +00:00
public signup(member: Member, password: string): Observable<Member> {
2018-04-06 06:59:49 +00:00
return this.restService.request<Member>('post', '/account/signup', {
2018-04-11 06:40:12 +00:00
body: {
member: member,
2018-04-12 08:06:15 +00:00
password: password,
2018-04-11 06:40:12 +00:00
},
2018-04-06 06:59:49 +00:00
});
}
2018-04-30 11:50:47 +00:00
public modify(member: Member): Observable<Member> {
return this.rpcService.call<Member>('MemberService.modify', member, '');
}
2018-05-03 10:33:19 +00:00
public sendEmailResetPassword(email: string): Observable<Member> {
return this.rpcService.call<Member>('MemberService.sendEmailForPassword', email);
}
2018-04-06 06:59:49 +00:00
}