mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
- disable button if form.reasonCategory is falsy - extract valuesReasonCategoryOptions to global constant - extract reasonCategoryOptions to created lifecycle hook to keep data() clean and use map - extract formSchema to components/utils and test - remove validator from formSchema and validate based on "Deep Rules" https://github.com/yiminghe/async-validator#deep-rules - Use v-model to update reasonCategory and reasonDescription - default to error message in English from backend - Update template slot to use new syntax
26 lines
567 B
JavaScript
26 lines
567 B
JavaScript
import { valuesReasonCategoryOptions } from '~/constants/modals.js'
|
|
|
|
export default function validReport({ translate }) {
|
|
return {
|
|
formSchema: {
|
|
reasonCategory: {
|
|
type: 'object',
|
|
required: true,
|
|
fields: {
|
|
value: {
|
|
type: 'enum',
|
|
enum: valuesReasonCategoryOptions,
|
|
required: true,
|
|
message: translate('report.reason.category.invalid'),
|
|
},
|
|
},
|
|
},
|
|
reasonDescription: {
|
|
type: 'string',
|
|
min: 0,
|
|
max: 200,
|
|
},
|
|
},
|
|
}
|
|
}
|