Skip to content

Commit

Permalink
fix value check bug from production
Browse files Browse the repository at this point in the history
  • Loading branch information
patelradhika committed Sep 10, 2024
1 parent bbfabbd commit 5b48f92
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/layout/TopBar/TopBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ const TopBar = ({
const lng = LANGUAGES.find((item) => _.isEqual(item.value, googtransLng));
if (user && lng && !_.isEqual(user.user_language, lng.label)) {
const newLng = LANGUAGES.find((item) => _.isEqual(item.label, user.user_language));
document.cookie = `googtrans=/auto/${newLng.value}; Path=/; Domain=${window.location.hostname}`;
document.cookie = `googtrans=/auto/${(newLng && newLng.value) || 'en'}; Path=/; Domain=${window.location.hostname}`;
// eslint-disable-next-line no-alert
alert('Detected language change. So need to reload the website. It might take a little while for this.');
window.location.reload();
}
} else if (user && user.user_language) {
const isReloaded = sessionStorage.getItem('isReloaded');
const newLng = LANGUAGES.find((item) => _.isEqual(item.label, user.user_language));
document.cookie = `googtrans=/auto/${newLng.value}; Path=/; Domain=${window.location.hostname}`;
document.cookie = `googtrans=/auto/${(newLng && newLng.value) || 'en'}; Path=/; Domain=${window.location.hostname}`;
if (!isReloaded && !_.isEqual(user.user_language, 'English')) {
sessionStorage.setItem('isReloaded', 'true');
// eslint-disable-next-line no-alert
Expand Down

0 comments on commit 5b48f92

Please sign in to comment.