Client - fix checkbox style when unchecked on privacy policy validation

This commit is contained in:
Sam 2024-01-06 15:44:00 +01:00
parent df5bee936c
commit e07a31cd0b

View File

@ -13,7 +13,7 @@
{{ $t('user.PROFILE.BACK_TO_PROFILE') }} {{ $t('user.PROFILE.BACK_TO_PROFILE') }}
</button> </button>
</div> </div>
<form v-else @submit.prevent="onSubmit()"> <form v-else :class="{ errors: formErrors }" @submit.prevent="onSubmit()">
<div class="policy-content"> <div class="policy-content">
<PrivacyPolicy /> <PrivacyPolicy />
</div> </div>
@ -23,6 +23,7 @@
id="accepted_policy" id="accepted_policy"
required required
v-model="acceptedPolicy" v-model="acceptedPolicy"
@invalid="invalidateForm"
/> />
<span> <span>
<i18n-t keypath="user.READ_AND_ACCEPT_PRIVACY_POLICY"> <i18n-t keypath="user.READ_AND_ACCEPT_PRIVACY_POLICY">
@ -66,6 +67,7 @@
() => store.getters[ROOT_STORE.GETTERS.ERROR_MESSAGES] () => store.getters[ROOT_STORE.GETTERS.ERROR_MESSAGES]
) )
const acceptedPolicy = ref(false) const acceptedPolicy = ref(false)
const formErrors = ref(false)
function onSubmit() { function onSubmit() {
store.dispatch( store.dispatch(
@ -73,6 +75,9 @@
acceptedPolicy.value acceptedPolicy.value
) )
} }
function invalidateForm() {
formErrors.value = true
}
onUnmounted(() => { onUnmounted(() => {
store.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES) store.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)