Commit 6a1a91e2 authored by MARCO Jonathan's avatar MARCO Jonathan
Browse files

馃悰 Add the facultative chaining in the condition

parent 07f30830
......@@ -62,14 +62,14 @@ export const messagesGetter: GetterTree<FormState, RootState> = {
) => string => {
return (id, prop, type = 'fields'): string => {
let translation: string = '';
if (state.messages.current && state.messages.locales[state.messages.current][id]) {
if (state.messages.current && state.messages.locales?.[state.messages.current]?.[id]) {
translation = <string | undefined>(state.messages.locales?.[state.messages.current]?.[id] as Locale)?.[prop] || '';
}
if (
translation === '' &&
state.messages.current !== state.messages.defaultLocale &&
state.messages.locales[state.messages.defaultLocale][id]
state.messages.locales?.[state.messages.defaultLocale]?.[id]
) {
translation = <string>(state.messages.locales?.[state.messages.defaultLocale]?.[id] as Locale)?.[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