Commit 60916a94 authored by MARCO Jonathan's avatar MARCO Jonathan
Browse files

馃悰 Add facultative chaining to translated getters

parent 1fc72be6
Pipeline #69964 canceled with stage
......@@ -63,7 +63,7 @@ export const messagesGetter: GetterTree<FormState, RootState> = {
return (id, prop, type = 'fields'): string => {
let translation: string = '';
if (state.messages.current && state.messages.locales[state.messages.current][id]) {
translation = <string | undefined>(state.messages.locales[state.messages.current][id] as Locale)[prop] || '';
translation = <string | undefined>(state.messages.locales?.[state.messages.current]?.[id] as Locale)?.[prop] || '';
}
if (
......@@ -71,7 +71,7 @@ export const messagesGetter: GetterTree<FormState, RootState> = {
state.messages.current !== state.messages.defaultLocale &&
state.messages.locales[state.messages.defaultLocale][id]
) {
translation = <string>(state.messages.locales[state.messages.defaultLocale][id] as Locale)[prop] || '';
translation = <string>(state.messages.locales?.[state.messages.defaultLocale]?.[id] as Locale)?.[prop] || '';
}
if (translation === '' && (state[type][id] as Field)[prop]) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment