Client - update button text on registration
This commit is contained in:
parent
779738dccd
commit
8465c0e4cb
@ -34,7 +34,7 @@
|
|||||||
:placeholder="t('user.PASSWORD-CONFIRM')"
|
:placeholder="t('user.PASSWORD-CONFIRM')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit">{{ t('buttons.LOGIN') }}</button>
|
<button type="submit">{{ t(buttonText) }}</button>
|
||||||
</form>
|
</form>
|
||||||
<p v-if="errorMessage">
|
<p v-if="errorMessage">
|
||||||
{{ errorMessage }}
|
{{ errorMessage }}
|
||||||
@ -45,7 +45,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, reactive } from 'vue'
|
import { ComputedRef, computed, defineComponent, reactive } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
import { IFormData } from '@/interfaces'
|
import { IFormData } from '@/interfaces'
|
||||||
@ -60,7 +60,7 @@
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup() {
|
setup(props) {
|
||||||
const formData: IFormData = reactive({
|
const formData: IFormData = reactive({
|
||||||
username: '',
|
username: '',
|
||||||
email: '',
|
email: '',
|
||||||
@ -69,6 +69,14 @@
|
|||||||
})
|
})
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
|
const buttonText: ComputedRef<string> = computed(() =>
|
||||||
|
props.action === 'register' ? 'buttons.REGISTER' : 'buttons.LOGIN'
|
||||||
|
)
|
||||||
|
const errorMessage: ComputedRef<string | null> = computed(
|
||||||
|
() => store.getters[ROOT_STORE.GETTERS.ERROR_MESSAGE]
|
||||||
|
)
|
||||||
|
|
||||||
function onSubmit(actionType: string) {
|
function onSubmit(actionType: string) {
|
||||||
return store.dispatch(USER_STORE.ACTIONS.LOGIN_OR_REGISTER, {
|
return store.dispatch(USER_STORE.ACTIONS.LOGIN_OR_REGISTER, {
|
||||||
actionType,
|
actionType,
|
||||||
@ -77,10 +85,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
errorMessage: computed(
|
|
||||||
() => store.getters[ROOT_STORE.GETTERS.ERROR_MESSAGE]
|
|
||||||
),
|
|
||||||
t,
|
t,
|
||||||
|
buttonText,
|
||||||
|
errorMessage,
|
||||||
formData,
|
formData,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"LOGIN": "Log in"
|
"LOGIN": "Log in",
|
||||||
|
"REGISTER": "Register"
|
||||||
}
|
}
|
@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"LOGIN": "Se connecter"
|
"LOGIN": "Se connecter",
|
||||||
|
"REGISTER": "S'inscrire"
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user