From 72b3cb103fb516c829bba26fc35a833abb18c7d8 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Sat, 13 Apr 2024 14:19:30 -0500 Subject: [PATCH] Add conditional exports --- src/state/session/index.ts | 12 ++++++++++++ src/state/session/{index.tsx => v1.tsx} | 0 2 files changed, 12 insertions(+) create mode 100644 src/state/session/index.ts rename src/state/session/{index.tsx => v1.tsx} (100%) diff --git a/src/state/session/index.ts b/src/state/session/index.ts new file mode 100644 index 0000000000..a636d1d4d5 --- /dev/null +++ b/src/state/session/index.ts @@ -0,0 +1,12 @@ +import * as V1 from '#/state/session/v1' +import * as V2 from '#/state/session/v2' + +export type {CurrentAccount, SessionAccount} from '#/state/session/types' + +const isV2 = false + +export const getAgent = isV2 ? V2.getAgent : V1.getAgent +export const Provider = isV2 ? V2.Provider : V1.Provider +export const useSession = isV2 ? V2.useSession : V1.useSession +export const useSessionApi = isV2 ? V2.useSessionApi : V1.useSessionApi +export const useRequireAuth = isV2 ? V2.useRequireAuth : V1.useRequireAuth diff --git a/src/state/session/index.tsx b/src/state/session/v1.tsx similarity index 100% rename from src/state/session/index.tsx rename to src/state/session/v1.tsx