From c2a7890cdc3d408f1a011aba2a5bdd95ef810809 Mon Sep 17 00:00:00 2001 From: Johanna Szepanski <johanna.szepanski@softhouse.se> Date: Wed, 5 Mar 2025 15:58:52 +0100 Subject: [PATCH] joint export --- src/contexts/AuthContext.ts | 4 ++-- src/contexts/GlobalAppBarContext.ts | 2 +- src/contexts/index.ts | 12 ++++++++++++ src/index.js | 3 +-- 4 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 src/contexts/index.ts diff --git a/src/contexts/AuthContext.ts b/src/contexts/AuthContext.ts index b3820ed3..37ede1f4 100644 --- a/src/contexts/AuthContext.ts +++ b/src/contexts/AuthContext.ts @@ -1,6 +1,6 @@ import { createContext, useContext } from "react"; -export interface User { +interface User { fullName?: string; loginName?: string; avatar?: string; @@ -38,7 +38,7 @@ const defaultValue: AuthContextProps = { export const AuthContext = createContext<AuthContextProps>(defaultValue); -export const useUserContext = () => { +export const useAuthContext = () => { const { user, userRoles, diff --git a/src/contexts/GlobalAppBarContext.ts b/src/contexts/GlobalAppBarContext.ts index a87150a1..0a631d04 100644 --- a/src/contexts/GlobalAppBarContext.ts +++ b/src/contexts/GlobalAppBarContext.ts @@ -1,6 +1,6 @@ import { createContext, useContext } from "react"; -interface GlobalAppContext { +export interface GlobalAppContext { title: string; setTitle: (title: string) => void; } diff --git a/src/contexts/index.ts b/src/contexts/index.ts new file mode 100644 index 00000000..45be9ebe --- /dev/null +++ b/src/contexts/index.ts @@ -0,0 +1,12 @@ +import { AuthContext, useAuthContext } from "./AuthContext"; +import { + GlobalAppBarContext, + useGlobalAppBarContext +} from "./GlobalAppBarContext"; + +export { + AuthContext, + useAuthContext, + GlobalAppBarContext, + useGlobalAppBarContext +}; diff --git a/src/index.js b/src/index.js index c0581f78..683928af 100644 --- a/src/index.js +++ b/src/index.js @@ -1,8 +1,7 @@ export * from "./hooks/usePagination"; export * from "./hooks/useTypingTimer"; export * from "./hooks/useUniqueKeys"; -export * from "./contexts/AuthContext"; -export * from "./contexts/GlobalAppBarContext"; +export * from "./contexts"; export * from "./components/common/AlertBanner"; export * from "./components/common/ApiAlertError"; export * from "./components/common/AppLayout"; -- GitLab