diff --git a/src/app/(auth)/authorize/page.tsx b/src/app/(auth)/authorize/page.tsx
index 0c2ef71..f2e2a48 100644
--- a/src/app/(auth)/authorize/page.tsx
+++ b/src/app/(auth)/authorize/page.tsx
@@ -1,9 +1,6 @@
"use client";
-import { useEffect } from "react";
import Link from "next/link";
-import { useRouter } from "next/navigation";
-import Cookies from "js-cookie";
import { MessageCircleCode } from "lucide-react";
import { UserAuthorize } from "@/components/auth/user-authorize";
@@ -13,28 +10,6 @@ type Props = {
};
export default function AuthPage({ searchParams }: Props) {
- const router = useRouter();
-
- useEffect(() => {
- // 检查是否有 OAuth 状态参数
- const oauthState = Cookies.get("oauth_state");
- if (oauthState) {
- try {
- // 解码 OAuth 参数
- const params = JSON.parse(atob(oauthState));
- // 删除 cookie
- fetch("/api/auth/oauth-state", { method: "DELETE" }).catch(
- console.error,
- );
- // 构建重定向 URL
- const searchParams = new URLSearchParams(params);
- router.push(`/oauth/authorize?${searchParams.toString()}`);
- } catch (error) {
- console.error("Failed to process OAuth state:", error);
- }
- }
- }, [router]);
-
return (
diff --git a/src/app/(auth)/sign-in/page.tsx b/src/app/(auth)/sign-in/page.tsx
index 66b45be..f54f905 100644
--- a/src/app/(auth)/sign-in/page.tsx
+++ b/src/app/(auth)/sign-in/page.tsx
@@ -1,6 +1,5 @@
"use client";
-import { useEffect } from "react";
import Link from "next/link";
import { ChevronLeft, MessageCircleCode } from "lucide-react";
@@ -8,24 +7,7 @@ import { cn } from "@/lib/utils";
import { buttonVariants } from "@/components/ui/button";
import { UserAuthForm } from "@/components/auth/user-auth-form";
-interface Props {
- searchParams: { state?: string };
-}
-
-export default function LoginPage({ searchParams }: Props) {
- useEffect(() => {
- // 如果有 state 参数,保存到 cookie
- if (searchParams.state) {
- fetch("/api/auth/oauth-state", {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({ state: searchParams.state }),
- }).catch(console.error);
- }
- }, [searchParams.state]);
-
+export default function LoginPage() {
return (
<>
Q58 Connect
-
+
By clicking continue, you agree to our{" "}
{
- oauthState?: string;
-}
-
export function UserAuthForm({
className,
- oauthState,
...props
-}: UserAuthFormProps) {
+}: React.HTMLAttributes) {
const [isLoading, setIsLoading] = React.useState(false);
const router = useRouter();
const { toast } = useToast();
@@ -28,17 +23,6 @@ export function UserAuthForm({
const signIn = () => {
React.startTransition(async () => {
try {
- // 如果有 OAuth 参数,先保存到 cookie
- if (oauthState) {
- await fetch("/api/auth/oauth-state", {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({ state: oauthState }),
- });
- }
-
const response = await fetch("/api/auth/q58", {
method: "POST",
headers: {