mirror of
https://github.com/Steffo99/festa.git
synced 2024-12-23 07:04:22 +00:00
15 lines
514 B
TypeScript
15 lines
514 B
TypeScript
|
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>
|
||
|
)
|
||
|
}
|