feat: update dependencies and enhance authentication flow with context hooks

This commit is contained in:
2026-02-22 04:28:26 +08:00
parent 26f8d24b89
commit 3630144fb1
4 changed files with 55 additions and 29 deletions

View File

@@ -15,7 +15,7 @@ export const AuthProvider = ({ children, mustLogin }: Props) => {
useEffect(() => {
store.init()
}, [])
const loginUrl = '/root/login?redirect=' + encodeURIComponent(window.location.href);
const loginUrl = '/root/login/?redirect=' + encodeURIComponent(window.location.href);
if (mustLogin && !store.me) {
return (
<div className="w-full h-full min-h-screen flex items-center justify-center bg-background">
@@ -27,13 +27,15 @@ export const AuthProvider = ({ children, mustLogin }: Props) => {
<h2 className="text-xl font-semibold text-foreground"></h2>
<p className="text-sm text-muted-foreground">访</p>
</div>
<a
href={loginUrl}
<div
className="inline-flex items-center justify-center gap-2 w-full px-6 py-2.5 rounded-lg bg-foreground text-background text-sm font-medium transition-opacity hover:opacity-80 active:opacity-70"
onClick={() => {
window.open(loginUrl, '_self')
}}
>
<LogIn className="w-4 h-4" />
</a>
</div>
</div>
</div>
)