From 87da322115ec002f63cc41c4a684a6e8fa5541de Mon Sep 17 00:00:00 2001 From: richard-loafle <44828666+richard-loafle@users.noreply.github.com> Date: Fri, 3 Apr 2020 16:44:43 +0900 Subject: [PATCH] bug fixed --- package-lock.json | 8 ++--- package.json | 2 +- projects/store-authentication/ng-package.json | 2 ++ projects/store-authentication/package.json | 4 ++- .../src/lib/store/configuration/actions.ts | 34 +++++++++++++++++++ .../src/lib/store/configuration/effects.ts | 8 +++++ .../src/lib/store/configuration/reducers.ts | 25 ++++++++++++++ .../src/lib/store/configuration/state.ts | 27 +++++++++++++++ .../src/lib/store/effects.ts | 2 ++ .../src/lib/store/reducers.ts | 2 ++ .../src/lib/store/state.ts | 6 ++++ .../store-authentication/src/public-api.ts | 8 ++++- 12 files changed, 121 insertions(+), 7 deletions(-) create mode 100644 projects/store-authentication/src/lib/store/configuration/actions.ts create mode 100644 projects/store-authentication/src/lib/store/configuration/effects.ts create mode 100644 projects/store-authentication/src/lib/store/configuration/reducers.ts create mode 100644 projects/store-authentication/src/lib/store/configuration/state.ts diff --git a/package-lock.json b/package-lock.json index 5f6bd0e..6075867 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 30231d6..a007805 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/projects/store-authentication/ng-package.json b/projects/store-authentication/ng-package.json index bc65827..fe22ca3 100644 --- a/projects/store-authentication/ng-package.json +++ b/projects/store-authentication/ng-package.json @@ -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", diff --git a/projects/store-authentication/package.json b/projects/store-authentication/package.json index c7a8ccd..d3992a0 100644 --- a/projects/store-authentication/package.json +++ b/projects/store-authentication/package.json @@ -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", diff --git a/projects/store-authentication/src/lib/store/configuration/actions.ts b/projects/store-authentication/src/lib/store/configuration/actions.ts new file mode 100644 index 0000000..400dfc2 --- /dev/null +++ b/projects/store-authentication/src/lib/store/configuration/actions.ts @@ -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 }>() +); diff --git a/projects/store-authentication/src/lib/store/configuration/effects.ts b/projects/store-authentication/src/lib/store/configuration/effects.ts new file mode 100644 index 0000000..4306694 --- /dev/null +++ b/projects/store-authentication/src/lib/store/configuration/effects.ts @@ -0,0 +1,8 @@ +import { Injectable } from '@angular/core'; + +import { Actions } from '@ngrx/effects'; + +@Injectable() +export class Effects { + constructor(private actions$: Actions) {} +} diff --git a/projects/store-authentication/src/lib/store/configuration/reducers.ts b/projects/store-authentication/src/lib/store/configuration/reducers.ts new file mode 100644 index 0000000..3bafb90 --- /dev/null +++ b/projects/store-authentication/src/lib/store/configuration/reducers.ts @@ -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 + } + }; + }) +); diff --git a/projects/store-authentication/src/lib/store/configuration/state.ts b/projects/store-authentication/src/lib/store/configuration/state.ts new file mode 100644 index 0000000..756126c --- /dev/null +++ b/projects/store-authentication/src/lib/store/configuration/state.ts @@ -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(selector: Selector) { + return { + versionInfo2Response: createSelector( + selector, + (state: State) => state.versionInfo2Response + ), + urlInfoResponse: createSelector( + selector, + (state: State) => state.urlInfoResponse + ) + }; +} diff --git a/projects/store-authentication/src/lib/store/effects.ts b/projects/store-authentication/src/lib/store/effects.ts index 148dc4d..e1ee8ee 100644 --- a/projects/store-authentication/src/lib/store/effects.ts +++ b/projects/store-authentication/src/lib/store/effects.ts @@ -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[] = [ CommonEffects, + ConfigurationEffects, LoginEffects, AuthorizationEffects ]; diff --git a/projects/store-authentication/src/lib/store/reducers.ts b/projects/store-authentication/src/lib/store/reducers.ts index 5bbe353..f2a9479 100644 --- a/projects/store-authentication/src/lib/store/reducers.ts +++ b/projects/store-authentication/src/lib/store/reducers.ts @@ -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); diff --git a/projects/store-authentication/src/lib/store/state.ts b/projects/store-authentication/src/lib/store/state.ts index f482df1..5e50fbb 100644 --- a/projects/store-authentication/src/lib/store/state.ts +++ b/projects/store-authentication/src/lib/store/state.ts @@ -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) ); diff --git a/projects/store-authentication/src/public-api.ts b/projects/store-authentication/src/public-api.ts index 900f84f..25fdf72 100644 --- a/projects/store-authentication/src/public-api.ts +++ b/projects/store-authentication/src/public-api.ts @@ -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';