ContactEdit: fix constructor's type and rename journalUid.

master
Tom Hacohen 4 years ago
parent 8e8c779fa6
commit 9077f3878e

@ -120,8 +120,8 @@ interface PropsType {
collections: CachedCollection[]; collections: CachedCollection[];
initialCollection?: string; initialCollection?: string;
item?: ContactType; item?: ContactType;
onSave: (contact: ContactType, journalUid: string, originalContact?: ContactType) => Promise<void>; onSave: (contact: ContactType, collectionUid: string, originalContact?: ContactType) => Promise<void>;
onDelete: (contact: ContactType, journalUid: string) => void; onDelete: (contact: ContactType, collectionUid: string) => void;
onCancel: () => void; onCancel: () => void;
history: History<any>; history: History<any>;
} }
@ -143,11 +143,11 @@ class ContactEdit extends React.PureComponent<PropsType> {
note: string; note: string;
title: string; title: string;
journalUid: string; collectionUid: string;
showDeleteDialog: boolean; showDeleteDialog: boolean;
}; };
constructor(props: any) { constructor(props: PropsType) {
super(props); super(props);
this.state = { this.state = {
uid: "", uid: "",
@ -165,7 +165,7 @@ class ContactEdit extends React.PureComponent<PropsType> {
note: "", note: "",
title: "", title: "",
journalUid: "", collectionUid: "",
showDeleteDialog: false, showDeleteDialog: false,
}; };
@ -227,9 +227,9 @@ class ContactEdit extends React.PureComponent<PropsType> {
} }
if (props.initialCollection) { if (props.initialCollection) {
this.state.journalUid = props.initialCollection; this.state.collectionUid = props.initialCollection;
} else if (props.collections[0]) { } else if (props.collections[0]) {
this.state.journalUid = props.collections[0].collection.uid; this.state.collectionUid = props.collections[0].collection.uid;
} }
this.onSubmit = this.onSubmit.bind(this); this.onSubmit = this.onSubmit.bind(this);
this.handleChange = this.handleChange.bind(this); this.handleChange = this.handleChange.bind(this);
@ -360,7 +360,7 @@ class ContactEdit extends React.PureComponent<PropsType> {
setProperty("note", this.state.note); setProperty("note", this.state.note);
this.props.onSave(contact, this.state.journalUid, this.props.item) this.props.onSave(contact, this.state.collectionUid, this.props.item)
.then(() => { .then(() => {
this.props.history.goBack(); this.props.history.goBack();
}); });
@ -398,8 +398,8 @@ class ContactEdit extends React.PureComponent<PropsType> {
Saving to Saving to
</InputLabel> </InputLabel>
<Select <Select
name="journalUid" name="collectionUid"
value={this.state.journalUid} value={this.state.collectionUid}
onChange={this.handleInputChange} onChange={this.handleInputChange}
> >
{this.props.collections.map((x) => ( {this.props.collections.map((x) => (

Loading…
Cancel
Save