diff --git a/src/ts/@overflow/app/views/layout/AccountLayout.tsx b/src/ts/@overflow/app/views/layout/AccountLayout.tsx index 92bc9be..f68717d 100644 --- a/src/ts/@overflow/app/views/layout/AccountLayout.tsx +++ b/src/ts/@overflow/app/views/layout/AccountLayout.tsx @@ -11,6 +11,7 @@ import SignIn from '../member/SignIn'; import SignUp from '../member/SignUp'; import EmailConfirm from '../member/EmailConfirm'; import ForgotPassword from '../member/ForgotPassword'; +import PWConfirm from '../member/PWConfirm'; export interface Props extends RouteComponentProps { } @@ -36,6 +37,7 @@ class AccountLayout extends React.Component { + diff --git a/src/ts/@overflow/app/views/layout/LeftMenu.tsx b/src/ts/@overflow/app/views/layout/LeftMenu.tsx index 8bed6d1..034a1cf 100644 --- a/src/ts/@overflow/app/views/layout/LeftMenu.tsx +++ b/src/ts/@overflow/app/views/layout/LeftMenu.tsx @@ -120,6 +120,9 @@ class LeftMenu extends React.Component { this.props.onChangeUrl('/account/signup')} style={{ 'marginLeft': '30px' }}> Sign Up + this.props.onChangeUrl('/account/pw_confirm')} style={{ 'marginLeft': '30px' }}> + PW Confirm + this.props.onChangeUrl('/account/logout')} style={{ 'marginLeft': '30px' }}> Log Out diff --git a/src/ts/@overflow/app/views/member/PWConfirm.tsx b/src/ts/@overflow/app/views/member/PWConfirm.tsx new file mode 100644 index 0000000..2affe9d --- /dev/null +++ b/src/ts/@overflow/app/views/member/PWConfirm.tsx @@ -0,0 +1,26 @@ +import * as React from 'react'; +import { RouteComponentProps } from 'react-router'; +import PWConfirmContainer from '@overflow/member/react/PWConfirm'; + +export interface Props { +} +export interface State { +} + +class PWConfirm extends React.Component, object> { + + public constructor(props?: RouteComponentProps, context?: State) { + super(props, context); + + } + + public render(): JSX.Element { + return ( + + ); + } + +} + + +export default PWConfirm; diff --git a/src/ts/@overflow/member/react/PWConfirm.tsx b/src/ts/@overflow/member/react/PWConfirm.tsx new file mode 100644 index 0000000..61674e8 --- /dev/null +++ b/src/ts/@overflow/member/react/PWConfirm.tsx @@ -0,0 +1,28 @@ +import { connect, Dispatch } from 'react-redux'; +import { + PWConfirm, + StateProps as PWConfirmStateProps, + DispatchProps as PWConfirmDispatchProps, + Props as PWConfirmProps, +} from './components/PWConfirm'; +import PWConfirmState from '../redux/state/PWConfirm'; + +import * as PWConfirmActions from '../redux/action/pw_confirm'; +import { push as routerPush } from 'react-router-redux'; +import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest'; +export function mapStateToProps(state: any): PWConfirmStateProps { + return { + + }; +} + +export function mapDispatchToProps(dispatch: Dispatch): PWConfirmDispatchProps { + return { + // Todo SessionId put + onConfirmPassword: (pass: string) => { + dispatch(asyncRequestActions.request('MemberService', 'signin', PWConfirmActions.REQUEST, 'overflow@loafle.com', pass)); + }, + }; +} + +export default connect(mapStateToProps, mapDispatchToProps)(PWConfirm); diff --git a/src/ts/@overflow/member/react/SignIn.tsx b/src/ts/@overflow/member/react/SignIn.tsx index 0753048..6fd9d42 100644 --- a/src/ts/@overflow/member/react/SignIn.tsx +++ b/src/ts/@overflow/member/react/SignIn.tsx @@ -12,8 +12,10 @@ import { push as routerPush } from 'react-router-redux'; import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest'; export function mapStateToProps(state: SignInState, ownProps?: SignInStateProps): SignInStateProps { + console.log(state.error); return { isAuthenticated: state.isAuthenticated, + error:state.error, }; } diff --git a/src/ts/@overflow/member/react/components/PWConfirm.tsx b/src/ts/@overflow/member/react/components/PWConfirm.tsx new file mode 100644 index 0000000..f6e5095 --- /dev/null +++ b/src/ts/@overflow/member/react/components/PWConfirm.tsx @@ -0,0 +1,52 @@ +import *as React from 'react'; +import { + Input, + InputOnChangeData, + Button, + Form, + ButtonProps, +} from 'semantic-ui-react'; + +export interface StateProps { +} + +export interface DispatchProps { + onConfirmPassword?(pass:string):void; +} + +export type Props = StateProps & DispatchProps; + +export interface State { + pass: string; +} + +export class PWConfirm extends React.Component { + constructor(props: Props, context: State) { + super(props, context); + + this.state = { + pass:null, + }; + + } + + public render(): JSX.Element { + return ( +
+ , data: InputOnChangeData) => { + this.setState({ pass: data.value }); + }} /> + + + + + + ); + } + + private PWConfirmClick(event: React.SyntheticEvent, data: ButtonProps):void { + this.props.onConfirmPassword(this.state.pass); + } +} + diff --git a/src/ts/@overflow/member/react/components/SignIn.tsx b/src/ts/@overflow/member/react/components/SignIn.tsx index 51d7175..00b869f 100644 --- a/src/ts/@overflow/member/react/components/SignIn.tsx +++ b/src/ts/@overflow/member/react/components/SignIn.tsx @@ -17,6 +17,7 @@ const options = [ ]; export interface StateProps { isAuthenticated?:boolean; + error?:Error; } export interface DispatchProps { diff --git a/src/ts/@overflow/member/redux/action/modify.ts b/src/ts/@overflow/member/redux/action/modify.ts index e5a70d9..684c4c6 100644 --- a/src/ts/@overflow/member/redux/action/modify.ts +++ b/src/ts/@overflow/member/redux/action/modify.ts @@ -1,7 +1,3 @@ -import Action from '@overflow/commons/redux/Action'; -import Member from '@overflow/member/api/model/Member'; - -import ModifyPayload from '../payload/ModifyPayload'; // Action Type export type REQUEST = '@overflow/member/modify/REQUEST'; @@ -12,30 +8,3 @@ export const REQUEST: REQUEST = '@overflow/member/modify/REQUEST'; export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/modify/REQUEST_SUCCESS'; export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/modify/REQUEST_FAILURE'; -// Action Creater -export type request = (member: Member) => Action; -export type requestSuccess = (member: Member) => Action; -export type requestFailure = (error: Error) => Action; - -export const request: request = (member: Member): Action => { - return { - type: REQUEST, - payload: { - member: member, - }, - }; -}; - -export const requestSuccess: requestSuccess = (member: Member): Action => { - return { - type: REQUEST_SUCCESS, - payload: member, - }; -}; - -export const requestFailure: requestFailure = (error: Error): Action => { - return { - type: REQUEST_FAILURE, - error: error, - }; -}; diff --git a/src/ts/@overflow/member/redux/action/pw_change.ts b/src/ts/@overflow/member/redux/action/pw_change.ts index fdf2554..6f6b241 100644 --- a/src/ts/@overflow/member/redux/action/pw_change.ts +++ b/src/ts/@overflow/member/redux/action/pw_change.ts @@ -1,8 +1,3 @@ -import Action from '@overflow/commons/redux/Action'; -import Member from '@overflow/member/api/model/Member'; - -import PWChangePayload from '../payload/PWChangePayload'; - // Action Type export type REQUEST = '@overflow/member/pw_change/REQUEST'; export type REQUEST_SUCCESS = '@overflow/member/pw_change/REQUEST_SUCCESS'; @@ -12,30 +7,3 @@ export const REQUEST: REQUEST = '@overflow/member/pw_change/REQUEST'; export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/pw_change/REQUEST_SUCCESS'; export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/pw_change/REQUEST_FAILURE'; -// Action Creater -export type request = (pass: string) => Action; -export type requestSuccess = (member: Member) => Action; -export type requestFailure = (error: Error) => Action; - -export const request: request = (pass: string): Action => { - return { - type: REQUEST, - payload: { - pass: pass, - }, - }; -}; - -export const requestSuccess: requestSuccess = (member: Member): Action => { - return { - type: REQUEST_SUCCESS, - payload: member, - }; -}; - -export const requestFailure: requestFailure = (error: Error): Action => { - return { - type: REQUEST_FAILURE, - error: error, - }; -}; diff --git a/src/ts/@overflow/member/redux/action/pw_confirm.ts b/src/ts/@overflow/member/redux/action/pw_confirm.ts new file mode 100644 index 0000000..876dd36 --- /dev/null +++ b/src/ts/@overflow/member/redux/action/pw_confirm.ts @@ -0,0 +1,9 @@ +// Action Type +export type REQUEST = '@overflow/member/pw_confirm/REQUEST'; +export type REQUEST_SUCCESS = '@overflow/member/pw_confirm/REQUEST_SUCCESS'; +export type REQUEST_FAILURE = '@overflow/member/pw_confirm/REQUEST_FAILURE'; + +export const REQUEST: REQUEST = '@overflow/member/pw_confirm/REQUEST'; +export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/pw_confirm/REQUEST_SUCCESS'; +export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/pw_confirm/REQUEST_FAILURE'; + diff --git a/src/ts/@overflow/member/redux/action/read.ts b/src/ts/@overflow/member/redux/action/read.ts index e6ede60..f273054 100644 --- a/src/ts/@overflow/member/redux/action/read.ts +++ b/src/ts/@overflow/member/redux/action/read.ts @@ -1,7 +1,3 @@ -import Action from '@overflow/commons/redux/Action'; -import Member from '@overflow/member/api/model/Member'; - -import ReadPayload from '../payload/ReadPayload'; // Action Type export type REQUEST = '@overflow/member/read/REQUEST'; @@ -12,30 +8,3 @@ export const REQUEST: REQUEST = '@overflow/member/read/REQUEST'; export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/read/REQUEST_SUCCESS'; export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/read/REQUEST_FAILURE'; -// Action Creater -export type request = (id: number) => Action; -export type requestSuccess = (member: Member) => Action; -export type requestFailure = (error: Error) => Action; - -export const request: request = (id: number): Action => { - return { - type: REQUEST, - payload: { - id: id, - }, - }; -}; - -export const requestSuccess: requestSuccess = (member: Member): Action => { - return { - type: REQUEST_SUCCESS, - payload: member, - }; -}; - -export const requestFailure: requestFailure = (error: Error): Action => { - return { - type: REQUEST_FAILURE, - error: error, - }; -}; diff --git a/src/ts/@overflow/member/redux/action/signOut.ts b/src/ts/@overflow/member/redux/action/signOut.ts index 3670a73..d6594c4 100644 --- a/src/ts/@overflow/member/redux/action/signOut.ts +++ b/src/ts/@overflow/member/redux/action/signOut.ts @@ -1,4 +1,3 @@ -import Action from '@overflow/commons/redux/Action'; // Action Type export type REQUEST = '@overflow/member/signout/REQUEST'; @@ -8,27 +7,3 @@ export type REQUEST_FAILURE = '@overflow/member/signout/REQUEST_FAILURE'; export const REQUEST: REQUEST = '@overflow/member/signout/REQUEST'; export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/signout/REQUEST_SUCCESS'; export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/signout/REQUEST_FAILURE'; - -// Action Creater -export type request = () => Action; -export type requestSuccess = () => Action; -export type requestFailure = (error: Error) => Action; - -export const request: request = (): Action => { - return { - type: REQUEST, - }; -}; - -export const requestSuccess: requestSuccess = (): Action => { - return { - type: REQUEST_SUCCESS, - }; -}; - -export const requestFailure: requestFailure = (error: Error): Action => { - return { - type: REQUEST_FAILURE, - error: error, - }; -}; diff --git a/src/ts/@overflow/member/redux/payload/PWConfirmPayload.ts b/src/ts/@overflow/member/redux/payload/PWConfirmPayload.ts new file mode 100644 index 0000000..a8618cf --- /dev/null +++ b/src/ts/@overflow/member/redux/payload/PWConfirmPayload.ts @@ -0,0 +1,6 @@ +import Member from '../../api/model/Member'; +interface PWConfirmPayload { + pass: string; +} + +export default PWConfirmPayload; \ No newline at end of file diff --git a/src/ts/@overflow/member/redux/reducer/pwConfirm.ts b/src/ts/@overflow/member/redux/reducer/pwConfirm.ts new file mode 100644 index 0000000..7490008 --- /dev/null +++ b/src/ts/@overflow/member/redux/reducer/pwConfirm.ts @@ -0,0 +1,26 @@ +import Action from '@overflow/commons/redux/Action'; +import { ReducersMapObject } from 'redux'; +import Member from '@overflow/member/api/model/Member'; + +import * as PWConfirmActionTypes from '../action/signIn'; +import PWConfirmState, { defaultState as pwConfirmDefaultState } from '../state/PWConfirm'; + +const reducer: ReducersMapObject = { + [PWConfirmActionTypes.REQUEST_SUCCESS]: (state: PWConfirmState = pwConfirmDefaultState, action: Action): PWConfirmState => { + return { + ...state, + isPWConfirm: true, + }; + }, + [PWConfirmActionTypes.REQUEST_FAILURE]: (state: PWConfirmState = pwConfirmDefaultState, action: Action): PWConfirmState => { + if (action.error.name === 'SignInPwNotMatchException') { + // + } + return { + ...state, + error: new Error(action.error.name), + }; + }, +}; + +export default reducer; diff --git a/src/ts/@overflow/member/redux/reducer/signIn.ts b/src/ts/@overflow/member/redux/reducer/signIn.ts index 79752eb..6512d53 100644 --- a/src/ts/@overflow/member/redux/reducer/signIn.ts +++ b/src/ts/@overflow/member/redux/reducer/signIn.ts @@ -16,7 +16,10 @@ const reducer: ReducersMapObject = { if (action.error.name === 'SignInPwNotMatchException') { // } - return state; + return { + ...state, + error: new Error('SigninIdPwNotMatch'), + }; }, }; diff --git a/src/ts/@overflow/member/redux/state/PWConfirm.ts b/src/ts/@overflow/member/redux/state/PWConfirm.ts new file mode 100644 index 0000000..7ae76f3 --- /dev/null +++ b/src/ts/@overflow/member/redux/state/PWConfirm.ts @@ -0,0 +1,14 @@ +import Member from '../../api/model/Member'; + +export interface State { + readonly isPWConfirm: boolean; + readonly error?: Error; +} + +export const defaultState: State = { + isPWConfirm: undefined, + error: undefined, +}; + +export default State; +