bug fixed
This commit is contained in:
parent
f68faa5fba
commit
d511140c1d
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -2377,9 +2377,8 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@ucap/ng-store-authentication": {
|
"@ucap/ng-store-authentication": {
|
||||||
"version": "file:pack/ucap-ng-store-authentication-0.0.2.tgz",
|
"version": "file:pack/ucap-ng-store-authentication-0.0.3.tgz",
|
||||||
"integrity": "sha512-ohUQItPCnNKZrnBoH0lFNFSAHtZkRAfGnLTBXBa4+xapSKGO6h2XaWaszql+ava/q7nelFkNFmYHej0wVLWmdw==",
|
"integrity": "sha512-qgtPOxPDBWLytKNl4KxPJiAt+EhWk+7JZMiKGlrs/VqXgys4UHVv/OJhOC46d0ZBunswUsiEw4W97NXi+APW/w=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"@ucap/ng-store-chat": {
|
"@ucap/ng-store-chat": {
|
||||||
"version": "file:pack/ucap-ng-store-chat-0.0.3.tgz",
|
"version": "file:pack/ucap-ng-store-chat-0.0.3.tgz",
|
||||||
|
@ -2403,7 +2402,8 @@
|
||||||
},
|
},
|
||||||
"@ucap/ng-ui-authentication": {
|
"@ucap/ng-ui-authentication": {
|
||||||
"version": "file:pack/ucap-ng-ui-authentication-0.0.14.tgz",
|
"version": "file:pack/ucap-ng-ui-authentication-0.0.14.tgz",
|
||||||
"integrity": "sha512-wejkhebthEUub9nGigu9/fENB7hwOHrYTDq4dPmitxKeb3o1RNdbjAzaEB0QlVmLF+/ReydWZqr2d4d8Dus+/g=="
|
"integrity": "sha512-wejkhebthEUub9nGigu9/fENB7hwOHrYTDq4dPmitxKeb3o1RNdbjAzaEB0QlVmLF+/ReydWZqr2d4d8Dus+/g==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"@ucap/ng-ui-organization": {
|
"@ucap/ng-ui-organization": {
|
||||||
"version": "file:pack/ucap-ng-ui-organization-0.0.2.tgz",
|
"version": "file:pack/ucap-ng-ui-organization-0.0.2.tgz",
|
||||||
|
|
|
@ -165,7 +165,7 @@
|
||||||
"@ucap/ng-protocol-status": "file:pack/ucap-ng-protocol-status-0.0.1.tgz",
|
"@ucap/ng-protocol-status": "file:pack/ucap-ng-protocol-status-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-sync": "file:pack/ucap-ng-protocol-sync-0.0.1.tgz",
|
"@ucap/ng-protocol-sync": "file:pack/ucap-ng-protocol-sync-0.0.1.tgz",
|
||||||
"@ucap/ng-protocol-umg": "file:pack/ucap-ng-protocol-umg-0.0.1.tgz",
|
"@ucap/ng-protocol-umg": "file:pack/ucap-ng-protocol-umg-0.0.1.tgz",
|
||||||
"@ucap/ng-store-authentication": "file:pack/ucap-ng-store-authentication-0.0.2.tgz",
|
"@ucap/ng-store-authentication": "file:pack/ucap-ng-store-authentication-0.0.3.tgz",
|
||||||
"@ucap/ng-store-chat": "file:pack/ucap-ng-store-chat-0.0.3.tgz",
|
"@ucap/ng-store-chat": "file:pack/ucap-ng-store-chat-0.0.3.tgz",
|
||||||
"@ucap/ng-store-group": "file:pack/ucap-ng-store-group-0.0.3.tgz",
|
"@ucap/ng-store-group": "file:pack/ucap-ng-store-group-0.0.3.tgz",
|
||||||
"@ucap/ng-store-organization": "file:pack/ucap-ng-store-organization-0.0.3.tgz",
|
"@ucap/ng-store-organization": "file:pack/ucap-ng-store-organization-0.0.3.tgz",
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
"@ngrx/effects": "@ngrx/effects",
|
"@ngrx/effects": "@ngrx/effects",
|
||||||
"@ucap/pi": "@ucap/pi",
|
"@ucap/pi": "@ucap/pi",
|
||||||
"@ucap/protocol-authentication": "@ucap/protocol-authentication",
|
"@ucap/protocol-authentication": "@ucap/protocol-authentication",
|
||||||
|
"@ucap/protocol-option": "@ucap/protocol-option",
|
||||||
"@ucap/protocol-query": "@ucap/protocol-query",
|
"@ucap/protocol-query": "@ucap/protocol-query",
|
||||||
"@ucap/ng-pi": "@ucap/ng-pi",
|
"@ucap/ng-pi": "@ucap/ng-pi",
|
||||||
"@ucap/ng-protocol-authentication": "@ucap/ng-protocol-authentication",
|
"@ucap/ng-protocol-authentication": "@ucap/ng-protocol-authentication",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ucap/ng-store-authentication",
|
"name": "@ucap/ng-store-authentication",
|
||||||
"version": "0.0.2",
|
"version": "0.0.3",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "http://10.81.13.221:8081/nexus/repository/npm-ucap/"
|
"registry": "http://10.81.13.221:8081/nexus/repository/npm-ucap/"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { createAction, props } from '@ngrx/store';
|
import { createAction, props } from '@ngrx/store';
|
||||||
|
|
||||||
import { AuthRequest, AuthResponse } from '@ucap/protocol-query';
|
import { AuthRequest, AuthResponse } from '@ucap/protocol-query';
|
||||||
|
import { RegViewRequest, RegViewResponse } from '@ucap/protocol-option';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* retrieve authorization information
|
* retrieve authorization information
|
||||||
|
@ -23,3 +24,25 @@ export const authFailure = createAction(
|
||||||
'[ucap::authentication::authorization] auth Failure',
|
'[ucap::authentication::authorization] auth Failure',
|
||||||
props<{ error: any }>()
|
props<{ error: any }>()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* retrieve authorization information
|
||||||
|
*/
|
||||||
|
export const regView = createAction(
|
||||||
|
'[ucap::authentication::authorization] regView',
|
||||||
|
props<{ req: RegViewRequest }>()
|
||||||
|
);
|
||||||
|
/**
|
||||||
|
* Success of regView request
|
||||||
|
*/
|
||||||
|
export const regViewSuccess = createAction(
|
||||||
|
'[ucap::authentication::authorization] regView Success',
|
||||||
|
props<{ res: RegViewResponse }>()
|
||||||
|
);
|
||||||
|
/**
|
||||||
|
* Failure of regView request
|
||||||
|
*/
|
||||||
|
export const regViewFailure = createAction(
|
||||||
|
'[ucap::authentication::authorization] regView Failure',
|
||||||
|
props<{ error: any }>()
|
||||||
|
);
|
||||||
|
|
|
@ -8,8 +8,17 @@ import { Actions, createEffect, ofType } from '@ngrx/effects';
|
||||||
import { AuthResponse } from '@ucap/protocol-query';
|
import { AuthResponse } from '@ucap/protocol-query';
|
||||||
|
|
||||||
import { QueryProtocolService } from '@ucap/ng-protocol-query';
|
import { QueryProtocolService } from '@ucap/ng-protocol-query';
|
||||||
|
import { OptionProtocolService } from '@ucap/ng-protocol-option';
|
||||||
|
|
||||||
import { auth, authSuccess, authFailure } from './actions';
|
import {
|
||||||
|
auth,
|
||||||
|
authSuccess,
|
||||||
|
authFailure,
|
||||||
|
regView,
|
||||||
|
regViewSuccess,
|
||||||
|
regViewFailure
|
||||||
|
} from './actions';
|
||||||
|
import { RegViewResponse } from '@ucap/protocol-option';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class Effects {
|
export class Effects {
|
||||||
|
@ -30,8 +39,26 @@ export class Effects {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
regView$ = createEffect(() =>
|
||||||
|
this.actions$.pipe(
|
||||||
|
ofType(regView),
|
||||||
|
map(action => action.req),
|
||||||
|
exhaustMap(req => {
|
||||||
|
return this.optionProtocolService.regView(req).pipe(
|
||||||
|
map((res: RegViewResponse) => {
|
||||||
|
return regViewSuccess({
|
||||||
|
res
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
catchError(error => of(regViewFailure({ error })))
|
||||||
|
);
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private actions$: Actions,
|
private actions$: Actions,
|
||||||
private queryProtocolService: QueryProtocolService
|
private queryProtocolService: QueryProtocolService,
|
||||||
|
private optionProtocolService: OptionProtocolService
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,27 @@
|
||||||
import { Selector, createSelector } from '@ngrx/store';
|
import { Selector, createSelector } from '@ngrx/store';
|
||||||
|
|
||||||
import { AuthResponse } from '@ucap/protocol-query';
|
import { AuthResponse } from '@ucap/protocol-query';
|
||||||
|
import { RegViewResponse } from '@ucap/protocol-option';
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
auth?: AuthResponse;
|
authResponse?: AuthResponse | null;
|
||||||
|
regViewResponse: RegViewResponse | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const initialState: State = {
|
export const initialState: State = {
|
||||||
auth: null
|
authResponse: null,
|
||||||
|
regViewResponse: null
|
||||||
};
|
};
|
||||||
|
|
||||||
export function selectors<S>(selector: Selector<any, State>) {
|
export function selectors<S>(selector: Selector<any, State>) {
|
||||||
return {
|
return {
|
||||||
auth: createSelector(selector, (state: State) => state.auth)
|
authResponse: createSelector(
|
||||||
|
selector,
|
||||||
|
(state: State) => state.authResponse
|
||||||
|
),
|
||||||
|
regViewResponse: createSelector(
|
||||||
|
selector,
|
||||||
|
(state: State) => state.regViewResponse
|
||||||
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,64 +1,17 @@
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import { catchError, exhaustMap, map, switchMap } from 'rxjs/operators';
|
import { catchError, map, switchMap } from 'rxjs/operators';
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
import { Actions, ofType, createEffect } from '@ngrx/effects';
|
import { Actions, ofType, createEffect } from '@ngrx/effects';
|
||||||
|
|
||||||
import { Login2Response } from '@ucap/pi';
|
|
||||||
|
|
||||||
import { PiService } from '@ucap/ng-pi';
|
import { PiService } from '@ucap/ng-pi';
|
||||||
import { AuthenticationProtocolService } from '@ucap/ng-protocol-authentication';
|
import { AuthenticationProtocolService } from '@ucap/ng-protocol-authentication';
|
||||||
|
|
||||||
import {
|
import { logout, logoutSuccess } from './actions';
|
||||||
logout,
|
|
||||||
webLogin,
|
|
||||||
webLoginSuccess,
|
|
||||||
webLoginFailure,
|
|
||||||
logoutSuccess
|
|
||||||
} from './actions';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class Effects {
|
export class Effects {
|
||||||
webLogin$ = createEffect(() =>
|
|
||||||
this.actions$.pipe(
|
|
||||||
ofType(webLogin),
|
|
||||||
map(action => action),
|
|
||||||
exhaustMap(
|
|
||||||
(params: {
|
|
||||||
loginId: string;
|
|
||||||
loginPw: string;
|
|
||||||
companyCode: string;
|
|
||||||
rememberMe: boolean;
|
|
||||||
autoLogin: boolean;
|
|
||||||
}) =>
|
|
||||||
this.piService
|
|
||||||
.login2({
|
|
||||||
loginId: params.loginId,
|
|
||||||
loginPw: params.loginPw,
|
|
||||||
companyCode: params.companyCode
|
|
||||||
})
|
|
||||||
.pipe(
|
|
||||||
map((res: Login2Response) => {
|
|
||||||
if ('success' !== res.status.toLowerCase()) {
|
|
||||||
return webLoginFailure({ error: 'Failed' });
|
|
||||||
} else {
|
|
||||||
return webLoginSuccess({
|
|
||||||
loginId: params.loginId,
|
|
||||||
loginPw: params.loginPw,
|
|
||||||
companyCode: params.companyCode,
|
|
||||||
rememberMe: params.rememberMe,
|
|
||||||
autoLogin: params.autoLogin,
|
|
||||||
login2Response: res
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
catchError(error => of(webLoginFailure({ error })))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
logout$ = createEffect(() => {
|
logout$ = createEffect(() => {
|
||||||
return this.actions$.pipe(
|
return this.actions$.pipe(
|
||||||
ofType(logout),
|
ofType(logout),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user