diff --git a/src/ts/@overflow/app/config/index.ts b/src/ts/@overflow/app/config/index.ts index 074e7e4..2344217 100644 --- a/src/ts/@overflow/app/config/index.ts +++ b/src/ts/@overflow/app/config/index.ts @@ -3,6 +3,8 @@ import SagaWatcher from '@overflow/commons/redux/saga/SagaWatcher'; import signInReducer from '@overflow/member/redux/reducer/signIn'; import signUpReducer from '@overflow/member/redux/reducer/signUp'; +import modifyMemberReducer from '@overflow/member/redux/reducer/modify'; +import readMemberReducer from '@overflow/member/redux/reducer/read'; import readAllProbeReducer from '@overflow/probe/redux/reducer/readAllByDomain'; import readProbeReducer from '@overflow/probe/redux/reducer/read'; @@ -50,7 +52,7 @@ export interface RPCConfig { url: string; } const rpcConfig: RPCConfig = { - url: 'ws://192.168.1.209:18081/rpc', + url: 'ws://192.168.1.103:18081/rpc', }; // Redux Configuration @@ -70,6 +72,8 @@ const reduxConfig: ReduxConfig = { state: reduxState, reducerMaps: [ signInReducer, + readMemberReducer, + modifyMemberReducer, readAllProbeReducer, readProbeReducer, sensorReadAllByTargetReducer, diff --git a/src/ts/@overflow/member/react/Modify.tsx b/src/ts/@overflow/member/react/Modify.tsx index 3b862b6..fba55c9 100644 --- a/src/ts/@overflow/member/react/Modify.tsx +++ b/src/ts/@overflow/member/react/Modify.tsx @@ -11,9 +11,10 @@ import State from '../redux/state/Modify'; import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest'; import { push as routerPush } from 'react-router-redux'; import * as modifyActions from '../redux/action/modify'; +import * as readActions from '../redux/action/read'; -export function mapStateToProps(state: any): ModifyStateProps { +export function mapStateToProps(state: State, ownProps?:ModifyStateProps): ModifyStateProps { return { member: state.member, }; @@ -23,10 +24,9 @@ export function mapDispatchToProps(dispatch: Dispatch): ModifyDispatchProps return { onModify: (member: Member) => { dispatch(asyncRequestActions.request('MemberService', 'modify', modifyActions.REQUEST, JSON.stringify(member))); - // dispatch(signupActions.request(member)); }, - onReadMember: (id: Number) => { - dispatch(asyncRequestActions.request('MemberService', 'read', modifyActions.REQUEST, id)); + onReadMember: (id: number) => { + dispatch(asyncRequestActions.request('MemberService', 'read', readActions.REQUEST, JSON.stringify(id))); }, onRedirectHome: () => { dispatch(routerPush('/')); diff --git a/src/ts/@overflow/member/react/components/Modify.tsx b/src/ts/@overflow/member/react/components/Modify.tsx index 06ab736..387913e 100644 --- a/src/ts/@overflow/member/react/components/Modify.tsx +++ b/src/ts/@overflow/member/react/components/Modify.tsx @@ -64,9 +64,15 @@ export class Modify extends React.Component { } public render(): JSX.Element { + console.log('dddddddddddddddddddddddd'); + console.log(this.props.member); + let modifyElement = null; - let modifyElement =
- + if (this.props.member === null || this.props.member === undefined) { + return null; + } + modifyElement = + , data: InputOnChangeData) => { this.setState({ name: data.value }); @@ -82,17 +88,17 @@ export class Modify extends React.Component { this.setState({ passCon: data.value }); } } /> - , data: InputOnChangeData) => { this.setState({ company: data.value }); } }/> - , data: InputOnChangeData) => { this.setState({ country: data.value }); } } /> - , data: InputOnChangeData) => { this.setState({ phone: data.value }); } diff --git a/src/ts/@overflow/member/redux/payload/ModifyPayload.ts b/src/ts/@overflow/member/redux/payload/ModifyPayload.ts index e237815..c256fed 100644 --- a/src/ts/@overflow/member/redux/payload/ModifyPayload.ts +++ b/src/ts/@overflow/member/redux/payload/ModifyPayload.ts @@ -1,6 +1,7 @@ import Member from '../../api/model/Member'; interface ModifyPayload { - member: Member; + member?: Member; + id?: number; } export default ModifyPayload; diff --git a/src/ts/@overflow/member/redux/reducer/modify.ts b/src/ts/@overflow/member/redux/reducer/modify.ts index 5c15c15..27dc807 100644 --- a/src/ts/@overflow/member/redux/reducer/modify.ts +++ b/src/ts/@overflow/member/redux/reducer/modify.ts @@ -1,3 +1,27 @@ /** * Created by geek on 17. 7. 3. */ +import Action from '@overflow/commons/redux/Action'; +import { ReducersMapObject } from 'redux'; +import Member from '@overflow/member/api/model/Member'; + +import * as ModifyActionTypes from '../action/modify'; +import ModifyState, { defaultState as modifyDefaultState } from '../state/Modify'; + +const reducer: ReducersMapObject = { + [ModifyActionTypes.REQUEST_SUCCESS]: (state: ModifyState = modifyDefaultState, action: Action): ModifyState => { + return { + ...state, + member: action.payload, + }; + }, + [ModifyActionTypes.REQUEST_FAILURE]: (state: ModifyState = modifyDefaultState, action: Action): ModifyState => { + + return { + ...state, + error: new Error('SigninIdPwNotMatch'), + }; + }, +}; + +export default reducer; diff --git a/src/ts/@overflow/member/redux/reducer/read.ts b/src/ts/@overflow/member/redux/reducer/read.ts index 5c15c15..aa83a77 100644 --- a/src/ts/@overflow/member/redux/reducer/read.ts +++ b/src/ts/@overflow/member/redux/reducer/read.ts @@ -1,3 +1,30 @@ /** * Created by geek on 17. 7. 3. */ +/** + * Created by geek on 17. 7. 3. + */ +import Action from '@overflow/commons/redux/Action'; +import { ReducersMapObject } from 'redux'; +import Member from '@overflow/member/api/model/Member'; + +import * as ReadActionTypes from '../action/read'; +import ReadState, { defaultState as readDefaultState } from '../state/Modify'; + +const reducer: ReducersMapObject = { + [ReadActionTypes.REQUEST_SUCCESS]: (state: ReadState = readDefaultState, action: Action): ReadState => { + return { + ...state, + member: action.payload, + }; + }, + [ReadActionTypes.REQUEST_FAILURE]: (state: ReadState = readDefaultState, action: Action): ReadState => { + + return { + ...state, + error: new Error('SigninIdPwNotMatch'), + }; + }, +}; + +export default reducer; \ No newline at end of file diff --git a/src/ts/@overflow/member/redux/state/Read.ts b/src/ts/@overflow/member/redux/state/Read.ts index 5c15c15..76a15b5 100644 --- a/src/ts/@overflow/member/redux/state/Read.ts +++ b/src/ts/@overflow/member/redux/state/Read.ts @@ -1,3 +1,16 @@ /** * Created by geek on 17. 7. 3. */ +import Member from '../../api/model/Member'; + +export interface State { + readonly member?: Member; + readonly error?: Error; +} + +export const defaultState: State = { + member: undefined, + error: undefined, +}; + +export default State; \ No newline at end of file