fix: previous bug from 2 more places
This commit is contained in:
@@ -1032,6 +1032,12 @@ export default {
|
||||
data.province_id = this.user.province_id
|
||||
data.city_name = this.user.city_name
|
||||
data.city_id = this.user.city_id
|
||||
const oldValues = [
|
||||
'verity',
|
||||
'panatech',
|
||||
'both',
|
||||
]
|
||||
data.representation_type = data.representation_type.filter(x => !oldValues.includes(x))
|
||||
|
||||
this.$axios
|
||||
.post(`/api/user/representation`, data)
|
||||
@@ -1091,6 +1097,12 @@ export default {
|
||||
data.city_id = this.user.city_id
|
||||
data.mobile_number = this.user.mobile_number
|
||||
}
|
||||
const oldValues = [
|
||||
'verity',
|
||||
'panatech',
|
||||
'both',
|
||||
]
|
||||
data.representation_type = data.representation_type.filter(x => !oldValues.includes(x))
|
||||
|
||||
const url = this.isAdmin ? `/api/admin/updateAgent/${this.data._id}` : `/api/user/representation/${this.data._id}`
|
||||
this.$axios
|
||||
|
||||
@@ -323,8 +323,14 @@ module.exports.edit_representation_by_user = [
|
||||
'car_audio_video',
|
||||
'home_products'
|
||||
]
|
||||
const oldValues = [
|
||||
'verity',
|
||||
'panatech',
|
||||
'both',
|
||||
]
|
||||
if (!Array.isArray(value)) return Promise.reject(new Error('نوع نمایندگی باید به صورت آرایه باشد'))
|
||||
if (value.length === 0) return Promise.reject(new Error('حداقل یک نوع نمایندگی را انتخاب کنید'))
|
||||
value = value.filter(x => !oldValues.includes(x))
|
||||
const isValid = value.every(item => acceptedValues.includes(item))
|
||||
if (!isValid) return Promise.reject(new Error('مقدار نامعتبر برای نوع نمایندگی'))
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user