feat: use oauth provider
This commit is contained in:
36
web/src/context/oauth/provider.tsx
Normal file
36
web/src/context/oauth/provider.tsx
Normal file
@ -0,0 +1,36 @@
|
||||
import { useState, type FC, type ReactNode } from "react";
|
||||
import { OAuthContext } from ".";
|
||||
|
||||
interface IOAuthProvider {
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export const OAuthProvider: FC<IOAuthProvider> = ({ children }) => {
|
||||
const [active, setActive] = useState(false);
|
||||
const [clientID, setClientID] = useState("");
|
||||
const [redirectURI, setRedirectURI] = useState("");
|
||||
const [scope, setScope] = useState<string[]>([]);
|
||||
const [state, setState] = useState("");
|
||||
const [nonce, setNonce] = useState("");
|
||||
|
||||
return (
|
||||
<OAuthContext.Provider
|
||||
value={{
|
||||
active,
|
||||
clientID,
|
||||
redirectURI,
|
||||
scope,
|
||||
state,
|
||||
nonce,
|
||||
setActive,
|
||||
setClientID,
|
||||
setRedirectURI,
|
||||
setScope,
|
||||
setState,
|
||||
setNonce,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</OAuthContext.Provider>
|
||||
);
|
||||
};
|
Reference in New Issue
Block a user