MT#64156 Phonebook error bugfix

Previously the error handling did not properly identify the duplicate
number error. Now we check the API response message to detect duplicate
entry errors and display the appropriate error directly on the number
field in the phonebook form.

Change-Id: Ifbde6304d79e62c076eb2f683a1e4bb06151ff38
mr14.1
nidrissi-zouggari 6 months ago committed by Nouhaila Idrissi-Zouggari
parent ec97299ed7
commit 43aadbcce1

@ -163,7 +163,7 @@ export default {
await this.createPhonebookSubscriber(this.formData) await this.createPhonebookSubscriber(this.formData)
await this.$router.push('/user/subscriber-phonebook/') await this.$router.push('/user/subscriber-phonebook/')
} catch (error) { } catch (error) {
if (error.response && error.response.status === 422) { if (error.response && error.response.data.message === "Duplicate entry 'subscriber_id-number") {
this.numberError = true this.numberError = true
this.numberErrorMessage = this.$t('This number is already in use.') this.numberErrorMessage = this.$t('This number is already in use.')
} else { } else {

Loading…
Cancel
Save