member props modify
This commit is contained in:
		
							parent
							
								
									07fbd85925
								
							
						
					
					
						commit
						6a94fbc73e
					
				
							
								
								
									
										26
									
								
								src/ts/@overflow/member/react/PWChange.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								src/ts/@overflow/member/react/PWChange.tsx
									
									
									
									
									
										Normal file
									
								
							@ -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<any>): PWCangeDispatchProps {
 | 
			
		||||
  return {
 | 
			
		||||
    onResetPassword: (pass: string) => {
 | 
			
		||||
      dispatch(pwChangeActions.request(pass));
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default connect(mapStateToProps, mapDispatchToProps)(PWChange);
 | 
			
		||||
@ -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<SignInState>): SignInProps {
 | 
			
		||||
export function mapDispatchToProps(dispatch: Dispatch<any>): SigninDispatchProps {
 | 
			
		||||
  return {
 | 
			
		||||
    onSignin: (signinId: string, signinPw: string) => {
 | 
			
		||||
    onSignIn: (signinId: string, signinPw: string) => {
 | 
			
		||||
      dispatch(signinActions.request(signinId, signinPw));
 | 
			
		||||
    },
 | 
			
		||||
    onSignup: () => {
 | 
			
		||||
      return;
 | 
			
		||||
    },
 | 
			
		||||
    onResetPassword: () => {
 | 
			
		||||
      return;
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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<SignUpState>): SignUpProps {
 | 
			
		||||
export function mapDispatchToProps(dispatch: Dispatch<any>): SignUpProps {
 | 
			
		||||
  return {
 | 
			
		||||
    onSignin: () => {
 | 
			
		||||
      return;
 | 
			
		||||
    },
 | 
			
		||||
    onSignup: (member: Member) => {
 | 
			
		||||
    onSignUp: (member: Member) => {
 | 
			
		||||
      dispatch(signupActions.request(member));
 | 
			
		||||
    },
 | 
			
		||||
    onResetPassword: () => {
 | 
			
		||||
      return;
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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<Props, State> {
 | 
			
		||||
  constructor(props: Props, context: State) {
 | 
			
		||||
@ -28,11 +34,6 @@ export class PWChange extends React.Component<Props, State> {
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public onSubmit():void {
 | 
			
		||||
    console.log(this.state);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  public render(): JSX.Element {
 | 
			
		||||
    return (
 | 
			
		||||
      <Container fluid>
 | 
			
		||||
@ -51,7 +52,7 @@ export class PWChange extends React.Component<Props, State> {
 | 
			
		||||
                    this.setState({ passCon: data.value });
 | 
			
		||||
                  }} />
 | 
			
		||||
                <Form.Group>
 | 
			
		||||
                  <Button primary fluid style={{margin:'7'}} onClick={this.onSubmit}>    Submit  </Button>
 | 
			
		||||
                  <Button primary fluid style={{margin:'7'}} onClick={this.passChangeClick}>    Submit  </Button>
 | 
			
		||||
                  <Button fluid style={{margin:'7'}}>    Cancel  </Button>
 | 
			
		||||
                </Form.Group>
 | 
			
		||||
              </Form>
 | 
			
		||||
@ -64,7 +65,8 @@ export class PWChange extends React.Component<Props, State> {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  private passChangeClick(event: React.SyntheticEvent<HTMLButtonElement>, data: ButtonProps):void {
 | 
			
		||||
    this.props.onResetPassword(this.state.pass);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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<Props, State> {
 | 
			
		||||
                  <a style={{fontSize:10}} onClick={this.forgotPopupOpen}>Forgot Password</a>
 | 
			
		||||
                </div>
 | 
			
		||||
                <Form.Group>
 | 
			
		||||
                <Button fluid primary style={{margin:'7'}} onClick={this.onSignIn}>    Sign In  </Button>
 | 
			
		||||
                <Button fluid primary style={{margin:'7'}} onClick={ this.signInClick }>    Sign In  </Button>
 | 
			
		||||
                <Button fluid style={{margin:'7'}} href='/#/test2'>    Sign Up  </Button>
 | 
			
		||||
                </Form.Group>
 | 
			
		||||
              </Form>
 | 
			
		||||
@ -115,9 +123,9 @@ export class SignIn extends React.Component<Props, State> {
 | 
			
		||||
      sendComPopup: true,
 | 
			
		||||
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  private onSignIn = () => {
 | 
			
		||||
    console.log(this.state);
 | 
			
		||||
  private signInClick(event: React.SyntheticEvent<HTMLButtonElement>, data: ButtonProps):void {
 | 
			
		||||
    this.props.onSignIn(this.state.email, this.state.pass);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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<Props, State> {
 | 
			
		||||
@ -44,10 +43,6 @@ export class SignUp extends React.Component<Props, State> {
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public onSubmit():void {
 | 
			
		||||
    console.log(this.state);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public onChange (event: React.SyntheticEvent<HTMLInputElement>, data: InputOnChangeData):void {
 | 
			
		||||
    console.log(event);
 | 
			
		||||
    console.log(data);
 | 
			
		||||
@ -97,7 +92,7 @@ export class SignUp extends React.Component<Props, State> {
 | 
			
		||||
                  }
 | 
			
		||||
                } />
 | 
			
		||||
                <Form.Group>
 | 
			
		||||
                  <Button primary fluid style={{margin:'7'}} onClick={this.onSubmit}>   Sign Up  </Button>
 | 
			
		||||
                  <Button primary fluid style={{margin:'7'}} onClick={this.onSignUp}>   Sign Up  </Button>
 | 
			
		||||
                  <Button fluid style={{margin:'7'}}>    Cancel  </Button>
 | 
			
		||||
                </Form.Group>
 | 
			
		||||
              </Form>
 | 
			
		||||
@ -110,6 +105,10 @@ export class SignUp extends React.Component<Props, State> {
 | 
			
		||||
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
  //
 | 
			
		||||
  // private onSignUp():void {
 | 
			
		||||
  //   console.log('');
 | 
			
		||||
  // }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										41
									
								
								src/ts/@overflow/member/redux/action/pw_change.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								src/ts/@overflow/member/redux/action/pw_change.ts
									
									
									
									
									
										Normal file
									
								
							@ -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<PWChangePayload>;
 | 
			
		||||
export type requestSuccess = (member: Member) => Action<Member>;
 | 
			
		||||
export type requestFailure = (error: Error) => Action;
 | 
			
		||||
 | 
			
		||||
export const request: request = (pass: string): Action<PWChangePayload> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST,
 | 
			
		||||
    payload: {
 | 
			
		||||
      pass: pass,
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestSuccess: requestSuccess = (member: Member): Action<Member> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_SUCCESS,
 | 
			
		||||
    payload: member,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestFailure: requestFailure = (error: Error): Action => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_FAILURE,
 | 
			
		||||
    error: error,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										6
									
								
								src/ts/@overflow/member/redux/payload/PWChangePayload.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/ts/@overflow/member/redux/payload/PWChangePayload.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
			
		||||
import Member from '../../api/model/Member';
 | 
			
		||||
interface PWChangePayload {
 | 
			
		||||
  pass: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default PWChangePayload;
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user