member modify
This commit is contained in:
parent
db1d85e600
commit
653dcf6354
|
@ -22,8 +22,8 @@ export function mapStateToProps(state: State, ownProps?:ModifyStateProps): Modif
|
|||
|
||||
export function mapDispatchToProps(dispatch: Dispatch<any>): ModifyDispatchProps {
|
||||
return {
|
||||
onModify: (member: Member) => {
|
||||
dispatch(asyncRequestActions.request('MemberService', 'modify', modifyActions.REQUEST, JSON.stringify(member)));
|
||||
onModify: (member: Member, pw: string) => {
|
||||
dispatch(asyncRequestActions.request('MemberService', 'modify', modifyActions.REQUEST, JSON.stringify(member), pw));
|
||||
},
|
||||
onReadMember: (id: number) => {
|
||||
dispatch(asyncRequestActions.request('MemberService', 'read', readActions.REQUEST, JSON.stringify(id)));
|
||||
|
|
|
@ -14,7 +14,7 @@ export interface StateProps {
|
|||
}
|
||||
|
||||
export interface DispatchProps {
|
||||
onModify?(member: Member): void;
|
||||
onModify?(member: Member, pw: string): void;
|
||||
onReadMember?(id: Number): void;
|
||||
onRedirectHome():void;
|
||||
}
|
||||
|
@ -64,16 +64,15 @@ export class Modify extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
console.log('dddddddddddddddddddddddd');
|
||||
console.log(this.props.member);
|
||||
|
||||
let modifyElement = null;
|
||||
|
||||
if (this.props.member === null || this.props.member === undefined) {
|
||||
return null;
|
||||
}
|
||||
modifyElement = <Form>
|
||||
<Form.Input fluid value={this.props.member.email} placeholder='Email' disabled/>
|
||||
<Form.Input fluid placeholder='Name' onChange= {
|
||||
<Form.Input fluid defaultValue={this.props.member.email} placeholder='Email' disabled/>
|
||||
<Form.Input fluid placeholder='Name' defaultValue={this.props.member.name} onChange= {
|
||||
(event: React.SyntheticEvent<HTMLInputElement>, data: InputOnChangeData) => {
|
||||
this.setState({ name: data.value });
|
||||
}
|
||||
|
@ -88,7 +87,7 @@ export class Modify extends React.Component<Props, State> {
|
|||
this.setState({ passCon: data.value });
|
||||
}
|
||||
} />
|
||||
<Form.Input fluid placeholder='Company' value={this.props.member.companyName} onChange={
|
||||
<Form.Input fluid placeholder='Company' defaultValue={this.props.member.companyName} onChange={
|
||||
(event: React.SyntheticEvent<HTMLInputElement>, data: InputOnChangeData) => {
|
||||
this.setState({ company: data.value });
|
||||
}
|
||||
|
@ -98,7 +97,7 @@ export class Modify extends React.Component<Props, State> {
|
|||
this.setState({ country: data.value });
|
||||
}
|
||||
} />
|
||||
<Form.Input fluid placeholder='phone' value={this.props.member.phone} onChange={
|
||||
<Form.Input fluid placeholder='phone' defaultValue={this.props.member.phone} onChange={
|
||||
(event: React.SyntheticEvent<HTMLInputElement>, data: InputOnChangeData) => {
|
||||
this.setState({ phone: data.value });
|
||||
}
|
||||
|
@ -126,13 +125,15 @@ export class Modify extends React.Component<Props, State> {
|
|||
return;
|
||||
}
|
||||
|
||||
member.email = this.state.email;
|
||||
member.id = this.props.member.id;
|
||||
member.email = this.props.member.email;
|
||||
member.name = this.state.name;
|
||||
member.companyName = this.state.company;
|
||||
member.phone = this.state.phone;
|
||||
member.status = this.props.member.status;
|
||||
// member.status = MemberStatus.NOAUTH;
|
||||
|
||||
this.props.onModify(member);
|
||||
this.props.onModify(member, this.state.pass);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user