|
@@ -145,9 +145,9 @@ const props = defineProps({
|
|
|
default: false,
|
|
default: false,
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
- * Faut-il rafraichir le profil à la soumission du formulaire?
|
|
|
|
|
|
|
+ * Faut-il rafraichir le profil à la soumission du formulaire ?
|
|
|
*/
|
|
*/
|
|
|
- refreshProfile: {
|
|
|
|
|
|
|
+ refreshProfileOnSubmit: {
|
|
|
type: Boolean,
|
|
type: Boolean,
|
|
|
required: false,
|
|
required: false,
|
|
|
default: false,
|
|
default: false,
|
|
@@ -230,7 +230,7 @@ const submit = async (next: string | null = null) => {
|
|
|
|
|
|
|
|
emit('update:model-value', updatedEntity)
|
|
emit('update:model-value', updatedEntity)
|
|
|
|
|
|
|
|
- if (props.refreshProfile) {
|
|
|
|
|
|
|
+ if (props.refreshProfileOnSubmit) {
|
|
|
await refreshProfile()
|
|
await refreshProfile()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -246,17 +246,19 @@ const submit = async (next: string | null = null) => {
|
|
|
} else if (next === SUBMIT_TYPE.SAVE_AND_BACK) {
|
|
} else if (next === SUBMIT_TYPE.SAVE_AND_BACK) {
|
|
|
onSaveAndQuitAction(actionArgs)
|
|
onSaveAndQuitAction(actionArgs)
|
|
|
}
|
|
}
|
|
|
- } catch (error: any) {
|
|
|
|
|
|
|
+ } catch (error: unknown) {
|
|
|
|
|
+
|
|
|
|
|
+ const err = error as { response?: { status: number, data: { violations?: Array<{ message: string, propertyPath: string }> } } }
|
|
|
if (
|
|
if (
|
|
|
- error.response &&
|
|
|
|
|
- error.response.status === 422 &&
|
|
|
|
|
- error.response.data.violations
|
|
|
|
|
|
|
+ err.response &&
|
|
|
|
|
+ err.response.status === 422 &&
|
|
|
|
|
+ err.response.data.violations
|
|
|
) {
|
|
) {
|
|
|
// TODO: à revoir
|
|
// TODO: à revoir
|
|
|
const violations: Array<string> = []
|
|
const violations: Array<string> = []
|
|
|
let fields: AnyJson = {}
|
|
let fields: AnyJson = {}
|
|
|
|
|
|
|
|
- for (const violation of error.response.data.violations) {
|
|
|
|
|
|
|
+ for (const violation of err.response.data.violations) {
|
|
|
violations.push(i18n.t(violation.message) as string)
|
|
violations.push(i18n.t(violation.message) as string)
|
|
|
fields = Object.assign(fields, {
|
|
fields = Object.assign(fields, {
|
|
|
[violation.propertyPath]: violation.message,
|
|
[violation.propertyPath]: violation.message,
|