比赛
All checks were successful
Deploy to Server / deploy (push) Successful in 37s

This commit is contained in:
jeremygan2021
2026-03-10 11:09:15 +08:00
parent 724dd3857c
commit 417cda952d
11 changed files with 778 additions and 3 deletions

View File

@@ -7,6 +7,10 @@ const AuthContext = createContext(null);
export const AuthProvider = ({ children }) => {
const [user, setUser] = useState(null);
const [loading, setLoading] = useState(true);
const [loginModalVisible, setLoginModalVisible] = useState(false);
const showLoginModal = () => setLoginModalVisible(true);
const hideLoginModal = () => setLoginModalVisible(false);
useEffect(() => {
const initAuth = async () => {
@@ -72,7 +76,7 @@ export const AuthProvider = ({ children }) => {
};
return (
<AuthContext.Provider value={{ user, login, logout, updateUser, loading }}>
<AuthContext.Provider value={{ user, login, logout, updateUser, loading, loginModalVisible, showLoginModal, hideLoginModal }}>
{children}
</AuthContext.Provider>
);