Skip to content

Commit

Permalink
Merge pull request #237 from suvarnakale/shiksha-2.0
Browse files Browse the repository at this point in the history
Issue #220010 bug: language flickering issue solved
  • Loading branch information
itsvick authored Jun 5, 2024
2 parents 657dc77 + 05a48e0 commit cf16291
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/pages/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ const LoginPage = () => {
const [usernameError, setUsernameError] = useState(false);
const [passwordError, setPasswordError] = useState(false);
const [loading, setLoading] = useState(false);
const [selectedLanguage, setSelectedLanguage] = useState('en');
const [lang, setLang] = useState('');
const [selectedLanguage, setSelectedLanguage] = useState(lang);
const [language, setLanguage] = useState(selectedLanguage);
const [scrolling, setScrolling] = useState(false);

Expand All @@ -62,8 +63,13 @@ const LoginPage = () => {

useEffect(() => {
if (typeof window !== 'undefined' && window.localStorage) {
const lang = localStorage.getItem('preferredLanguage') || 'en';
if (localStorage.getItem('preferredLanguage')) {
var lang = localStorage.getItem('preferredLanguage') || 'en';
} else {
lang = 'en';
}
setLanguage(lang);
setLang(lang);
const token = localStorage.getItem('token');
if (token) {
router.push('/dashboard');
Expand Down Expand Up @@ -311,8 +317,16 @@ const LoginPage = () => {
</Link>
</Box>
<Box marginTop={'1.2rem'} className="remember-me-checkbox">
<Checkbox onChange={(e) => setRememberMe(e.target.checked)} checked={rememberMe} />
<span style={{ 'cursor': 'pointer'}} onClick={() => setRememberMe(!rememberMe)}>{t('LOGIN_PAGE.REMEMBER_ME')}</span>
<Checkbox
onChange={(e) => setRememberMe(e.target.checked)}
checked={rememberMe}
/>
<span
style={{ cursor: 'pointer' }}
onClick={() => setRememberMe(!rememberMe)}
>
{t('LOGIN_PAGE.REMEMBER_ME')}
</span>
</Box>
<Box
alignContent={'center'}
Expand Down

0 comments on commit cf16291

Please sign in to comment.