We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"@authing/guard-react18@5.1.2"
using with Next.js SSR
// pages/app.tsx import {GuardProvider, JwtTokenStatus, useGuard, User} from '@authing/guard-react18'; import {useEffect, useState} from "react"; import {Button} from "@mui/material"; const App = () => { const guard = useGuard(); const [isLoading, setLoading] = useState<boolean>(true); const [userInfo, setUserInfo] = useState<User | null>(null); console.log('render', userInfo); useEffect(() => { console.log(guard); setLoading(true); guard.trackSession().then((res: User | null) => { setUserInfo(res) }).finally(() => { setLoading(false); }); }, []); if (isLoading) { return null; } if (!userInfo) { return <div> <Button onClick={() => guard.startWithRedirect()}> 登录 </Button> 这里是被登录保护的页面 </div> } return <div> <style jsx>{` textarea { width: 100%; height: 400px; } `}</style> <div> <Button onClick={async () => { console.log('guard.logout', guard.logout); await guard.logout(); console.log('logout finished'); }}> 退出 </Button> 已经登录成功了 </div> <div> <textarea readOnly={true} value={JSON.stringify(userInfo, ' ', 2)} /> </div> </div>; };
The text was updated successfully, but these errors were encountered:
It's me.
Sorry, something went wrong.
zhaoyiming0803
No branches or pull requests
"@authing/guard-react18@5.1.2"
using with Next.js SSR
The text was updated successfully, but these errors were encountered: