This commit is contained in:
2018-10-02 15:07:28 +02:00
parent c93cdb1e43
commit 3d33a5b0d1
4 changed files with 72 additions and 13 deletions

View File

@ -59,6 +59,7 @@ const PasswordManager = inject("rootStore") ( observer(
this.onChangeInput = this.onChangeInput.bind(this);
this.addDoc = this.addDoc.bind(this);
this.updateDoc = this.updateDoc.bind(this);
this.deleteDoc = this.deleteDoc.bind(this);
this.state = {
newWindowOpen: false,
@ -111,6 +112,21 @@ const PasswordManager = inject("rootStore") ( observer(
}
deleteDoc(editIndex) {
//Delete doc locally
var newArr = [];
this.state.data.forEach(function(element, index) {
if(index !== editIndex) {
newArr.push(element);
}
});
this.setState({
data: newArr
});
}
onChangeInput(e) {
//Encryption key and search input
@ -265,7 +281,7 @@ const PasswordManager = inject("rootStore") ( observer(
<div>
<New addDoc={this.addDoc} encryptionkey={this.state.key} open={this.state.newWindowOpen} toggleNewWindow={this.toggleNewWindow} />
<Edit updateDoc={this.updateDoc} data={this.state.data} editIndex={this.state.editIndex} encryptionkey={this.state.key} open={this.state.editWindowOpen} toggleEditWindow={this.toggleEditWindow} />
<Edit updateDoc={this.updateDoc} deleteDoc={this.deleteDoc} data={this.state.data} editIndex={this.state.editIndex} encryptionkey={this.state.key} open={this.state.editWindowOpen} toggleEditWindow={this.toggleEditWindow} />
<Headline black="Password " red="manager" />