Add change location workaround.

This commit is contained in:
Paulo Gustavo Veiga 2022-11-19 11:58:43 -08:00
parent fa5def64ca
commit 51a5b39129

View File

@ -26,15 +26,19 @@ const LanguageMenu = (): React.ReactElement => {
const open = Boolean(anchorEl); const open = Boolean(anchorEl);
const intl = useIntl(); const intl = useIntl();
const mutation = useMutation((locale: LocaleCode) => client.updateAccountLanguage(locale), { // Todo: For some reasons, in some situations locale is null. More research needed.
onSuccess: () => { const mutation = useMutation(
queryClient.invalidateQueries('account'); (locale: LocaleCode) => client.updateAccountLanguage(locale ? locale : 'en'),
handleClose(); {
onSuccess: () => {
queryClient.invalidateQueries('account');
handleClose();
},
onError: (error) => {
console.error(`Unexpected error ${error}`);
},
}, },
onError: (error) => { );
console.error(`Unexpected error ${error}`);
},
});
const handleMenu = (event: React.MouseEvent<HTMLElement>) => { const handleMenu = (event: React.MouseEvent<HTMLElement>) => {
setAnchorEl(event.currentTarget); setAnchorEl(event.currentTarget);