1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-23 07:04:22 +00:00
festa/components/auth/provider.tsx

15 lines
514 B
TypeScript
Raw Normal View History

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 (
<AuthContext.Provider value={useLocalStorageAuthState(storageKey)}>
{children}
</AuthContext.Provider>
)
}