This commit is contained in:
crusader 2018-03-13 16:14:39 +09:00
parent 3cdee810bb
commit 51f9df8a99
5 changed files with 9 additions and 5 deletions

View File

@ -39,8 +39,8 @@ export class Effects {
.ofType(ActionType.SigninSuccess) .ofType(ActionType.SigninSuccess)
.map((action: SigninSuccess) => action.payload) .map((action: SigninSuccess) => action.payload)
.do( .do(
(result: Map<string, any>) => { (result) => {
const authToken = result['authToken']; const authToken = result.authToken;
// console.log(`authToken: ${authToken}`); // console.log(`authToken: ${authToken}`);
const expires = new Date(); const expires = new Date();

View File

@ -69,6 +69,7 @@ export class RxWebsocketSubject<T> extends Subject<T> {
} }
public connect(): void { public connect(): void {
console.log('RxWebsocketSubject.connect');
const wsSubjectConfig = Object.assign({}, this._wsSubjectConfig); const wsSubjectConfig = Object.assign({}, this._wsSubjectConfig);
if (undefined !== this._queryString) { if (undefined !== this._queryString) {
wsSubjectConfig.url = wsSubjectConfig.url + '?' + this._queryString; wsSubjectConfig.url = wsSubjectConfig.url + '?' + this._queryString;
@ -98,6 +99,7 @@ export class RxWebsocketSubject<T> extends Subject<T> {
}); });
this._reconnectionObservable.subscribe( this._reconnectionObservable.subscribe(
() => { () => {
console.log('RxWebsocketSubject._reconnectionObservable.subscribe');
this.connect(); this.connect();
}, },
null, null,

View File

@ -24,7 +24,7 @@ export class Signin implements Action {
export class SigninSuccess implements Action { export class SigninSuccess implements Action {
readonly type = ActionType.SigninSuccess; readonly type = ActionType.SigninSuccess;
constructor(public payload: any) {} constructor(public payload: {authToken: string, domainMember: DomainMember}) {}
} }
export class SigninFailure implements Action { export class SigninFailure implements Action {

View File

@ -48,7 +48,9 @@ export class Effects {
return this.memberService.signin(payload.email, payload.password); return this.memberService.signin(payload.email, payload.password);
}) })
.map((result: any) => { .map((result: any) => {
return new SigninSuccess(result); const authToken = result['authToken'];
const domainMember = JSON.parse(result['domainMember']);
return new SigninSuccess({authToken: authToken, domainMember: domainMember});
}) })
.catch((error: RESTError) => { .catch((error: RESTError) => {
return of(new SigninFailure(error)); return of(new SigninFailure(error));

View File

@ -23,7 +23,7 @@ export function reducer(state = initialState, action: Actions): State {
} }
case ActionType.SigninSuccess: { case ActionType.SigninSuccess: {
const domainMember = action.payload['domainMember']; const domainMember = action.payload.domainMember;
return { return {
...state, ...state,
signined: true, signined: true,