diff --git a/src/pages/credentials/index.tsx b/src/pages/credentials/index.tsx index 9c81883e5..b9b70c0b6 100644 --- a/src/pages/credentials/index.tsx +++ b/src/pages/credentials/index.tsx @@ -11,10 +11,9 @@ import { useRouter } from 'next/router'; import * as Yup from 'yup'; import { KeyAttributes } from 'types'; import { setKey, SESSION_KEYS, getKey } from 'utils/storage/sessionStorage'; -import CryptoWorker from 'utils/crypto'; +import CryptoWorker, { generateIntermediateKeyAttributes } from 'utils/crypto'; import { logoutUser } from 'services/userService'; -import { isFirstLogin } from 'utils/common'; -import { generateIntermediateKeyAttributes } from 'utils/crypto'; +import { isFirstLogin } from 'utils/storage'; const Image = styled.img` width: 200px; diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index 31079faef..a5964b132 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -29,7 +29,8 @@ import ConfirmDialog, { CONFIRM_ACTION } from 'components/ConfirmDialog'; import FullScreenDropZone from 'components/FullScreenDropZone'; import Sidebar from 'components/Sidebar'; import UploadButton from './components/UploadButton'; -import { checkConnectivity, isFirstLogin, setIsFirstLogin } from 'utils/common'; +import { checkConnectivity } from 'utils/common'; +import { isFirstLogin, setIsFirstLogin } from 'utils/storage'; import { logoutUser } from 'services/userService'; const DATE_CONTAINER_HEIGHT = 45; const IMAGE_CONTAINER_HEIGHT = 200; diff --git a/src/pages/verify/index.tsx b/src/pages/verify/index.tsx index ee96e0c96..5ae4452ca 100644 --- a/src/pages/verify/index.tsx +++ b/src/pages/verify/index.tsx @@ -16,7 +16,7 @@ import { clearFiles, isTokenValid, } from 'services/userService'; -import { setIsFirstLogin } from 'utils/common'; +import { setIsFirstLogin } from 'utils/storage'; const Image = styled.img` width: 350px; diff --git a/src/utils/common/index.ts b/src/utils/common/index.ts index 22471f618..77f30c5ac 100644 --- a/src/utils/common/index.ts +++ b/src/utils/common/index.ts @@ -16,10 +16,3 @@ export function getFileExtension(fileName): string { export function runningInBrowser() { return typeof window !== 'undefined'; } - -export const isFirstLogin = () => - getData(LS_KEYS.IS_FIRST_LOGIN)?.status ?? false; - -export function setIsFirstLogin(status) { - setData(LS_KEYS.IS_FIRST_LOGIN, { status }); -} diff --git a/src/utils/storage/index.ts b/src/utils/storage/index.ts new file mode 100644 index 000000000..65eaf7326 --- /dev/null +++ b/src/utils/storage/index.ts @@ -0,0 +1,8 @@ +import { getData, LS_KEYS, setData } from './localStorage'; + +export const isFirstLogin = () => + getData(LS_KEYS.IS_FIRST_LOGIN)?.status ?? false; + +export function setIsFirstLogin(status) { + setData(LS_KEYS.IS_FIRST_LOGIN, { status }); +}