member_webapp/@overflow/member/service/member.service.ts

63 lines
1.7 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';
2018-05-24 06:44:13 +00:00
import { RESTService } from '@loafer/ng-rest';
import { RPCService } from '@loafer/ng-rpc';
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
});
}
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> {
2018-05-06 09:40:18 +00:00
// return this.rpcService.call<Member>('MemberService.sendEmailForPassword', email);
return this.restService.request<Member>('post', '/account/send_email_pw', {
body: {
signinID: email,
},
});
}
public resetPassword(token: string, pw: string, confirmPw: string): Observable<Member> {
// return this.rpcService.call<Member>('MemberService.sendEmailForPassword', email);
return this.restService.request<Member>('post', '/account/reset_password', {
body: {
token: token,
pw: pw,
confirmPw: confirmPw,
},
});
2018-05-03 10:33:19 +00:00
}
2018-04-06 06:59:49 +00:00
}