diff --git a/frontend/src/context/storage/useStorage.tsx b/frontend/src/context/storage/useStorage.tsx index 131afcdd..fdc54edb 100644 --- a/frontend/src/context/storage/useStorage.tsx +++ b/frontend/src/context/storage/useStorage.tsx @@ -1,9 +1,5 @@ -import React, { - type ReactNode, - createContext, - useCallback, - useContext, -} from "react"; +import { createCustomContext } from "@utils/createCustomContext.function"; +import React, { type ReactNode, useCallback } from "react"; import { stringifyOrKepOriginal, tryParseJSON } from "./utils/parseJson"; @@ -14,20 +10,8 @@ interface IStorageContext { clear: () => void; } -const defaultStorageState = { - getItem: (_k: string) => null, - setItem: (_k: string, _v: string | object) => {}, - removeItem: (_k: string) => {}, - clear: () => {}, -}; - -const StorageContext = createContext(defaultStorageState); - -export function useStorage(): IStorageContext { - const context = useContext(StorageContext); - - return context; -} +export const [StorageContext, useStorage] = + createCustomContext("Storage Context"); export const StorageProvider: React.FC<{ children?: ReactNode }> = ({ children, diff --git a/frontend/src/providers/app.tsx b/frontend/src/providers/app.tsx index 3b3dc2e2..cca069e3 100644 --- a/frontend/src/providers/app.tsx +++ b/frontend/src/providers/app.tsx @@ -12,19 +12,22 @@ import "react-toastify/dist/ReactToastify.css"; import { AppRoutes } from "../routes"; export const App: FC = () => ( - - - - - + + + + + - - - - - + + + + + ); export default App;