diff --git a/src/ts/@overflow/member/react/PWChange.tsx b/src/ts/@overflow/member/react/PWChange.tsx new file mode 100644 index 0000000..b837b90 --- /dev/null +++ b/src/ts/@overflow/member/react/PWChange.tsx @@ -0,0 +1,26 @@ +import { connect, Dispatch } from 'react-redux'; +import { + PWChange, + StateProps as PWCangeStateProps, + DispatchProps as PWCangeDispatchProps, +} from './components/PWChange'; + + +import * as pwChangeActions from '../redux/action/pw_change'; + + +export function mapStateToProps(state: any): PWCangeStateProps { + return { + + }; +} + +export function mapDispatchToProps(dispatch: Dispatch): PWCangeDispatchProps { + return { + onResetPassword: (pass: string) => { + dispatch(pwChangeActions.request(pass)); + }, + }; +} + +export default connect(mapStateToProps, mapDispatchToProps)(PWChange); diff --git a/src/ts/@overflow/member/react/SignIn.tsx b/src/ts/@overflow/member/react/SignIn.tsx index 9c612c9..b8a100c 100644 --- a/src/ts/@overflow/member/react/SignIn.tsx +++ b/src/ts/@overflow/member/react/SignIn.tsx @@ -1,31 +1,25 @@ import { connect, Dispatch } from 'react-redux'; import { SignIn, - Props as SignInProps, - State as SignInState, + StateProps as SignInStateProps, + DispatchProps as SigninDispatchProps, } from './components/SignIn'; import State from '../redux/state/SignIn'; import * as signinActions from '../redux/action/signIn'; -export function mapStateToProps(state: SignInState): SignInProps { +export function mapStateToProps(state: any): SignInStateProps { return { }; } -export function mapDispatchToProps(dispatch: Dispatch): SignInProps { +export function mapDispatchToProps(dispatch: Dispatch): SigninDispatchProps { return { - onSignin: (signinId: string, signinPw: string) => { + onSignIn: (signinId: string, signinPw: string) => { dispatch(signinActions.request(signinId, signinPw)); }, - onSignup: () => { - return; - }, - onResetPassword: () => { - return; - }, }; } diff --git a/src/ts/@overflow/member/react/SignUp.tsx b/src/ts/@overflow/member/react/SignUp.tsx index dd9b004..dac5fb2 100644 --- a/src/ts/@overflow/member/react/SignUp.tsx +++ b/src/ts/@overflow/member/react/SignUp.tsx @@ -11,23 +11,17 @@ import State from '../redux/state/SignUp'; import * as signupActions from '../redux/action/signUp'; -export function mapStateToProps(state: SignUpState): SignUpProps { +export function mapStateToProps(state: any): SignUpProps { return { }; } -export function mapDispatchToProps(dispatch: Dispatch): SignUpProps { +export function mapDispatchToProps(dispatch: Dispatch): SignUpProps { return { - onSignin: () => { - return; - }, - onSignup: (member: Member) => { + onSignUp: (member: Member) => { dispatch(signupActions.request(member)); }, - onResetPassword: () => { - return; - }, }; } diff --git a/src/ts/@overflow/member/react/components/PWChange.tsx b/src/ts/@overflow/member/react/components/PWChange.tsx index 2900649..2f7e57b 100644 --- a/src/ts/@overflow/member/react/components/PWChange.tsx +++ b/src/ts/@overflow/member/react/components/PWChange.tsx @@ -6,16 +6,22 @@ import { Button, Grid, Form, - Container, + Container, ButtonProps, } from 'semantic-ui-react'; +export interface StateProps { +} + +export interface DispatchProps { + onResetPassword?(pass:string):void; +} + +export type Props = StateProps & DispatchProps; + export interface State { pass: string; passCon: string; } -export interface Props { - -} export class PWChange extends React.Component { constructor(props: Props, context: State) { @@ -28,11 +34,6 @@ export class PWChange extends React.Component { } - public onSubmit():void { - console.log(this.state); - } - - public render(): JSX.Element { return ( @@ -51,7 +52,7 @@ export class PWChange extends React.Component { this.setState({ passCon: data.value }); }} /> - + @@ -64,7 +65,8 @@ export class PWChange extends React.Component { ); } - - + private passChangeClick(event: React.SyntheticEvent, data: ButtonProps):void { + this.props.onResetPassword(this.state.pass); + } } diff --git a/src/ts/@overflow/member/react/components/SignIn.tsx b/src/ts/@overflow/member/react/components/SignIn.tsx index 0245d8f..0122ced 100644 --- a/src/ts/@overflow/member/react/components/SignIn.tsx +++ b/src/ts/@overflow/member/react/components/SignIn.tsx @@ -9,16 +9,24 @@ import { Grid, Form, Container, + ButtonProps, } from 'semantic-ui-react'; -const options = [{ key: 'southkorea', value: '82', text: 'South Korea(82)' }, -{ key: 'unitedstates', value: '1', text: 'United States(1)' }]; - - -export interface Props { - +const options = [ + { key: 'southkorea', value: '82', text: 'South Korea(82)' }, + { key: 'unitedstates', value: '1', text: 'United States(1)' }, +]; +export interface StateProps { } +export interface DispatchProps { + onSignIn?(signinId: string, signinPw: string ): void; + onSignUp?(): void; + onResetPassword?():void; +} + +export type Props = StateProps & DispatchProps; + export interface State { forgotPopup: boolean; sendComPopup: boolean; @@ -61,7 +69,7 @@ export class SignIn extends React.Component { Forgot Password - + @@ -115,9 +123,9 @@ export class SignIn extends React.Component { sendComPopup: true, }); - } + }; - private onSignIn = () => { - console.log(this.state); + private signInClick(event: React.SyntheticEvent, data: ButtonProps):void { + this.props.onSignIn(this.state.email, this.state.pass); } } diff --git a/src/ts/@overflow/member/react/components/SignUp.tsx b/src/ts/@overflow/member/react/components/SignUp.tsx index 81245ef..3d53b8a 100644 --- a/src/ts/@overflow/member/react/components/SignUp.tsx +++ b/src/ts/@overflow/member/react/components/SignUp.tsx @@ -1,17 +1,14 @@ import *as React from 'react'; import { - Input, InputOnChangeData, - Select, Button, - Dropdown, Grid, Form, Container, } from 'semantic-ui-react'; export interface Props { - + // onSignUp?():void; } export interface State { @@ -24,8 +21,10 @@ export interface State { country: string; } -const options = [{ key: 'southkorea', value: '82', text: 'South Korea(82)' }, - { key: 'unitedstates', value: '1', text: 'United States(1)' }] +const options = [ + { key: 'southkorea', value: '82', text: 'South Korea(82)' }, + { key: 'unitedstates', value: '1', text: 'United States(1)' }, +]; export class SignUp extends React.Component { @@ -44,10 +43,6 @@ export class SignUp extends React.Component { } - public onSubmit():void { - console.log(this.state); - } - public onChange (event: React.SyntheticEvent, data: InputOnChangeData):void { console.log(event); console.log(data); @@ -97,7 +92,7 @@ export class SignUp extends React.Component { } } /> - + @@ -110,6 +105,10 @@ export class SignUp extends React.Component { ); } + // + // private onSignUp():void { + // console.log(''); + // } } diff --git a/src/ts/@overflow/member/redux/action/pw_change.ts b/src/ts/@overflow/member/redux/action/pw_change.ts new file mode 100644 index 0000000..cbb1f63 --- /dev/null +++ b/src/ts/@overflow/member/redux/action/pw_change.ts @@ -0,0 +1,41 @@ +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'; +export type REQUEST_FAILURE = '@overflow/member/pw_change/REQUEST_FAILURE'; + +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, + }; +}; \ No newline at end of file diff --git a/src/ts/@overflow/member/redux/payload/PWChangePayload.ts b/src/ts/@overflow/member/redux/payload/PWChangePayload.ts new file mode 100644 index 0000000..ab9600a --- /dev/null +++ b/src/ts/@overflow/member/redux/payload/PWChangePayload.ts @@ -0,0 +1,6 @@ +import Member from '../../api/model/Member'; +interface PWChangePayload { + pass: string; +} + +export default PWChangePayload; \ No newline at end of file