diff --git a/src/containers/App.tsx b/src/containers/App.tsx index 523cde6..1dcee78 100644 --- a/src/containers/App.tsx +++ b/src/containers/App.tsx @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ import React, { useEffect } from 'react'; import { toast } from 'react-toastify'; import { PixabayBaseURL, PixabayKey } from '../utils'; @@ -32,17 +33,15 @@ const App = () => { useEffect(() => { const lang = sessionStorage.getItem(sessionStorageKeys.Lang); - if (typeof lang !== 'undefined' && lang !== null) { - if (lang === '') { - dispatch(setLang('en')); - } - - if (lang === null || undefined) { - sessionStorage.setItem(sessionStorageKeys.Lang, 'en'); - } + if (lang === '') { + dispatch(setLang('en')); + } - dispatch(setLang(lang!)); + if (!lang) { + sessionStorage.setItem(sessionStorageKeys.Lang, 'en'); } + + dispatch(setLang(lang!)); }, []); useEffect(() => {