From 6829c7911af5912fa3dd71204c5cae0ba33c6823 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 17 Jul 2022 03:32:36 +0200 Subject: [PATCH] Move `AuthContextProvider` to `components/auth/provider` --- components/auth/base.tsx | 14 -------------- components/auth/provider.tsx | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 components/auth/provider.tsx diff --git a/components/auth/base.tsx b/components/auth/base.tsx index a47187e..e3d9608 100644 --- a/components/auth/base.tsx +++ b/components/auth/base.tsx @@ -1,7 +1,5 @@ import { Token, User } from "@prisma/client" -import { default as React } from "react" import { createStateContext } from "../../utils/stateContext" -import { useLocalStorageAuthState } from "./storage" /** @@ -18,15 +16,3 @@ export type AuthContextContents = Token & { user: User } | null * Please note that the data containing in this context is not validated, and has to be validated by the server on every request. */ export const AuthContext = createStateContext() - - -/** - * Component which stores the login status using {@link useLocalStorageAuthState} and provides it to its children through a {@link AuthContext}. - */ -export function AuthContextProvider({ storageKey, children }: { storageKey: string, children: React.ReactNode }) { - return ( - - {children} - - ) -} \ No newline at end of file diff --git a/components/auth/provider.tsx b/components/auth/provider.tsx new file mode 100644 index 0000000..9327182 --- /dev/null +++ b/components/auth/provider.tsx @@ -0,0 +1,14 @@ +import { AuthContext } from "./base"; +import { useLocalStorageAuthState } from "./storage"; + + +/** + * Component which stores the login status using {@link useLocalStorageAuthState} and provides it to its children through a {@link AuthContext}. + */ +export function AuthContextProvider({ storageKey, children }: { storageKey: string, children: React.ReactNode }) { + return ( + + {children} + + ) +}