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