Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onError: err => {
// eslint-disable-next-line no-console
console.error(err)
Alerter.error(t('AccountSettings.failure'))
}
})
const onError = err => {
// eslint-disable-next-line no-console
console.warn('Could not save rule')
// eslint-disable-next-line no-console
console.error(err)
Alerter.error(t('Settings.rules.saving-error'))
}
async handleChooseFingerprint(fingerprintChoice) {
const t = this.props.t
try {
await this.savePin(this.state.chosenPin, fingerprintChoice)
} catch (e) {
Alerter.error(t('Pin.error-save'))
throw e
} finally {
this.setState({ saving: false })
}
Alerter.success(t('Pin.successfully-changed'))
this.props.onSaved()
}
onRemove = async () => {
const { group, router, client, t } = this.props
try {
await client.destroy(group)
router.push('/settings/groups')
} catch (err) {
logException(err)
Alerter.error(t('Groups.deletion_error'))
}
}
const handleRename = async () => {
try {
await renameRecurrenceManually(
client,
bundle,
renameInputRef.current.value
)
dismissAction()
Alerter.success(t('Recurrence.rename.save-success'))
} catch (e) {
Alerter.error(t('Recurrence.rename.save-error'))
}
}
data: {
type: 'io.cozy.notifications',
attributes: {
category: 'transaction-greater',
title: 'Test notification',
message: 'This is a test notification message',
preferred_channels: ['mobile', 'mail'],
content: 'This is a test notification text content',
content_html: 'This is a test notification HTML content'
}
}
})
Alerter.success('Notification sent')
} catch (err) {
Alerter.error('Failed to send notification: ' + err)
}
}
acceptUpdatedTos = async () => {
const cozyClient = this.props.client
try {
await cozyClient.stackClient.fetchJSON(
'PUT',
'/settings/instance/sign_tos'
)
this.setState({
warnings: this.state.warnings.filter(w => w.code !== 'tos-updated')
})
} catch (e) {
Alerter.error('TOS.updated.error')
}
}
async function() {
setSavingBundles(true)
try {
await saveHydratedBundles(client, finalBundles)
} catch (error) {
Alerter.error(error.message)
} finally {
setSavingBundles(false)
}
},
[finalBundles, client]
handleChange = async e => {
const { transaction, client, t } = this.props
transaction.reimbursementStatus = e.target.value
this.hideModal()
try {
await client.save(transaction)
} catch (err) {
logException(err)
Alerter.error(t('Transactions.reimbursementStatusUpdateError'))
}
}