|
@@ -224,31 +224,34 @@ export default {
|
|
|
/**
|
|
|
* Send an update of the share to the queue
|
|
|
*
|
|
|
- * @param {string} property the property to sync
|
|
|
+ * @param {string} propertyNames the properties to sync
|
|
|
*/
|
|
|
- queueUpdate(property) {
|
|
|
+ queueUpdate(...propertyNames) {
|
|
|
+ if (propertyNames.length === 0) {
|
|
|
+ // Nothing to update
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
if (this.share.id) {
|
|
|
+ const properties = {}
|
|
|
// force value to string because that is what our
|
|
|
// share api controller accepts
|
|
|
- const value = this.share[property].toString()
|
|
|
+ propertyNames.map(p => (properties[p] = this.share[p].toString()))
|
|
|
|
|
|
this.updateQueue.add(async() => {
|
|
|
this.saving = true
|
|
|
this.errors = {}
|
|
|
try {
|
|
|
- await this.updateShare(this.share.id, {
|
|
|
- property,
|
|
|
- value,
|
|
|
- })
|
|
|
+ await this.updateShare(this.share.id, properties)
|
|
|
|
|
|
// clear any previous errors
|
|
|
- this.$delete(this.errors, property)
|
|
|
+ this.$delete(this.errors, propertyNames[0])
|
|
|
|
|
|
// reset password state after sync
|
|
|
this.$delete(this.share, 'newPassword')
|
|
|
} catch ({ message }) {
|
|
|
if (message && message !== '') {
|
|
|
- this.onSyncError(property, message)
|
|
|
+ this.onSyncError(propertyNames[0], message)
|
|
|
}
|
|
|
} finally {
|
|
|
this.saving = false
|
|
@@ -288,6 +291,14 @@ export default {
|
|
|
}
|
|
|
break
|
|
|
}
|
|
|
+ case 'sendPasswordByTalk': {
|
|
|
+ // show error
|
|
|
+ this.$set(this.errors, property, message)
|
|
|
+
|
|
|
+ // Restore previous state
|
|
|
+ this.share.sendPasswordByTalk = !this.share.sendPasswordByTalk
|
|
|
+ break
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
|