bug fixed

This commit is contained in:
richard-loafle 2020-04-03 16:44:43 +09:00
parent 68d9deda92
commit 87da322115
12 changed files with 121 additions and 7 deletions

8
package-lock.json generated
View File

@ -2369,12 +2369,12 @@
},
"@ucap/ng-protocol-umg": {
"version": "file:pack/ucap-ng-protocol-umg-0.0.2.tgz",
"integrity": "sha512-JnILmpoqUc8zQKZqbucBJ2H68y3Oy7HB4h/Ax6bq4Ctqxk6qaA2/Eda65WTS8L4EresYdVGW07AR4Z0p0XLIzg=="
"integrity": "sha512-JnILmpoqUc8zQKZqbucBJ2H68y3Oy7HB4h/Ax6bq4Ctqxk6qaA2/Eda65WTS8L4EresYdVGW07AR4Z0p0XLIzg==",
"dev": true
},
"@ucap/ng-store-authentication": {
"version": "file:pack/ucap-ng-store-authentication-0.0.6.tgz",
"integrity": "sha512-qP3+rsni/z/JOTR/VPjH+09buvHphJc4IHMSS+HlAFvJPeLcWXWChANzpUG3tWNxEbrh8GhaOlzYkGyqBJTVLA==",
"dev": true
"version": "file:pack/ucap-ng-store-authentication-0.0.7.tgz",
"integrity": "sha512-6IxxjFYpmN3xC2zIix9BfXbHHKpZeeS09SlT7RujMGt58CPyLnWkCFa/a4NILYQpUaXwQn+CmB1o8nhaZvwMNw=="
},
"@ucap/ng-store-chat": {
"version": "file:pack/ucap-ng-store-chat-0.0.4.tgz",

View File

@ -165,7 +165,7 @@
"@ucap/ng-protocol-status": "file:pack/ucap-ng-protocol-status-0.0.2.tgz",
"@ucap/ng-protocol-sync": "file:pack/ucap-ng-protocol-sync-0.0.2.tgz",
"@ucap/ng-protocol-umg": "file:pack/ucap-ng-protocol-umg-0.0.2.tgz",
"@ucap/ng-store-authentication": "file:pack/ucap-ng-store-authentication-0.0.6.tgz",
"@ucap/ng-store-authentication": "file:pack/ucap-ng-store-authentication-0.0.7.tgz",
"@ucap/ng-store-chat": "file:pack/ucap-ng-store-chat-0.0.4.tgz",
"@ucap/ng-store-group": "file:pack/ucap-ng-store-group-0.0.5.tgz",
"@ucap/ng-store-organization": "file:pack/ucap-ng-store-organization-0.0.3.tgz",

View File

@ -7,6 +7,8 @@
"@ngrx/store": "@ngrx/store",
"@ngrx/effects": "@ngrx/effects",
"@ucap/core": "@ucap/core",
"@ucap/api-public": "@ucap/api-public",
"@ucap/api-external": "@ucap/api-external",
"@ucap/pi": "@ucap/pi",
"@ucap/protocol-authentication": "@ucap/protocol-authentication",
"@ucap/protocol-option": "@ucap/protocol-option",

View File

@ -1,6 +1,6 @@
{
"name": "@ucap/ng-store-authentication",
"version": "0.0.6",
"version": "0.0.7",
"publishConfig": {
"registry": "http://10.81.13.221:8081/nexus/repository/npm-ucap/"
},
@ -11,6 +11,8 @@
"@ngrx/entity": "^9.0.0",
"@ngrx/store": "^9.0.0",
"@ucap/core": "~0.0.1",
"@ucap/api-public": "~0.0.1",
"@ucap/api-external": "~0.0.1",
"@ucap/pi": "~0.0.1",
"@ucap/protocol-authentication": "~0.0.1",
"@ucap/protocol-option": "~0.0.1",

View File

@ -0,0 +1,34 @@
import { createAction, props } from '@ngrx/store';
import { VersionInfo2Response, VersionInfo2Request } from '@ucap/api-public';
import { UrlInfoRequest, UrlInfoResponse } from '@ucap/api-external';
export const versionInfo2 = createAction(
'[ucap::authentication::configuration] versionInfo2',
props<{ req: VersionInfo2Request }>()
);
export const versionInfo2Success = createAction(
'[ucap::authentication::configuration] versionInfo2 Success',
props<{ res: VersionInfo2Response }>()
);
export const versionInfo2Failure = createAction(
'[ucap::authentication::configuration] versionInfo2 Failure',
props<{ error: any }>()
);
export const urlInfo = createAction(
'[ucap::authentication::configuration] urlInfo',
props<{ req: UrlInfoRequest }>()
);
export const urlInfoSuccess = createAction(
'[ucap::authentication::configuration] urlInfo Success',
props<{ res: UrlInfoResponse }>()
);
export const urlInfoFailure = createAction(
'[ucap::authentication::configuration] urlInfo Failure',
props<{ error: any }>()
);

View File

@ -0,0 +1,8 @@
import { Injectable } from '@angular/core';
import { Actions } from '@ngrx/effects';
@Injectable()
export class Effects {
constructor(private actions$: Actions) {}
}

View File

@ -0,0 +1,25 @@
import { createReducer, on } from '@ngrx/store';
import { initialState } from './state';
import { versionInfo2Success, urlInfoSuccess } from './actions';
export const reducer = createReducer(
initialState,
on(versionInfo2Success, (state, action) => {
return {
...state,
versionInfo2Response: {
...state.versionInfo2Response,
...action.res
}
};
}),
on(urlInfoSuccess, (state, action) => {
return {
...state,
urlInfoResponse: {
...state.urlInfoResponse,
...action.res
}
};
})
);

View File

@ -0,0 +1,27 @@
import { Selector, createSelector } from '@ngrx/store';
import { VersionInfo2Response } from '@ucap/api-public';
import { UrlInfoResponse } from '@ucap/api-external';
export interface State {
versionInfo2Response: VersionInfo2Response | null;
urlInfoResponse: UrlInfoResponse | null;
}
export const initialState: State = {
versionInfo2Response: null,
urlInfoResponse: null
};
export function selectors<S>(selector: Selector<any, State>) {
return {
versionInfo2Response: createSelector(
selector,
(state: State) => state.versionInfo2Response
),
urlInfoResponse: createSelector(
selector,
(state: State) => state.urlInfoResponse
)
};
}

View File

@ -1,11 +1,13 @@
import { Type } from '@angular/core';
import { Effects as CommonEffects } from './common/effects';
import { Effects as ConfigurationEffects } from './configuration/effects';
import { Effects as LoginEffects } from './login/effects';
import { Effects as AuthorizationEffects } from './authorization/effects';
export const effects: Type<any>[] = [
CommonEffects,
ConfigurationEffects,
LoginEffects,
AuthorizationEffects
];

View File

@ -1,12 +1,14 @@
import { combineReducers, Action } from '@ngrx/store';
import { reducer as CommonReducer } from './common/reducers';
import { reducer as ConfigurationReducer } from './configuration/reducers';
import { reducer as LoginReducer } from './login/reducers';
import { reducer as AuthorizationReducer } from './authorization/reducers';
export function reducers(state: any | undefined, action: Action) {
return combineReducers({
common: CommonReducer,
configuration: ConfigurationReducer,
login: LoginReducer,
authorization: AuthorizationReducer
})(state, action);

View File

@ -1,6 +1,7 @@
import { createFeatureSelector, createSelector } from '@ngrx/store';
import * as CommonState from './common/state';
import * as ConfigurationState from './configuration/state';
import * as LoginState from './login/state';
import * as AuthorizationState from './authorization/state';
@ -8,6 +9,7 @@ export const KEY_FEATURE = 'authentication';
export interface State {
common: CommonState.State;
configuration: ConfigurationState.State;
login: LoginState.State;
authorization: AuthorizationState.State;
}
@ -18,6 +20,10 @@ export const CommonSelector = CommonState.selectors(
createSelector(Selector, (state: State) => state.common)
);
export const ConfigurationSelector = ConfigurationState.selectors(
createSelector(Selector, (state: State) => state.configuration)
);
export const LoginSelector = LoginState.selectors(
createSelector(Selector, (state: State) => state.login)
);

View File

@ -3,12 +3,18 @@
*/
import * as CommonActions from './lib/store/common/actions';
import * as ConfigurationActions from './lib/store/configuration/actions';
import * as LoginActions from './lib/store/login/actions';
import * as AuthorizationActions from './lib/store/authorization/actions';
export * from './lib/config/module-config';
export { CommonActions, LoginActions, AuthorizationActions };
export {
CommonActions,
ConfigurationActions,
LoginActions,
AuthorizationActions
};
export * from './lib/store/state';