* Added error display to every axios server call

* Added better destroy of login token if invalid
* Block users from opening notes they don't own, note closes automatically
* Beefed up login and home page a little to make them more appealing
This commit is contained in:
Max G
2020-04-14 05:09:19 +00:00
parent 7c15427b3d
commit a44bca204c
19 changed files with 114 additions and 23 deletions

View File

@@ -862,6 +862,13 @@
axios.post('/api/note/get', { 'noteId': this.noteid, 'password':this.hashedPass })
.then(response => {
//Block notes you don't have access to from opening
if(response.data === false){
this.$bus.$emit('notification', 'Invalid Note')
this.close(true)
return
}
//Set up local data
this.currentNoteId = this.noteid
this.rawTextId = response.data.rawTextId
@@ -918,6 +925,7 @@
})
})
.catch(error => { this.$bus.$emit('notification', 'Failed to Open Note') })
} else {
console.log('Could not fetch note')
}
@@ -1155,6 +1163,7 @@
this.startAutolockTimer()
return resolve(true)
})
.catch(error => { this.$bus.$emit('notification', 'Failed to Save Note') })
})
},
checkForUpdatedNote(){
@@ -1183,6 +1192,7 @@
this.updated = data.updated
}
})
.catch(error => { this.$bus.$emit('notification', 'Failed to get diff') })
}
//Track visibility state
@@ -1208,7 +1218,14 @@
return hash;
},
close(){
close(force = false){
if(force){
this.$bus.$emit('close_active_note', {
position: this.position, noteId: this.noteid, modified: this.modified
})
return
}
this.save().then( result => {