diff --git a/src/apis/auth/checkSignIn.ts b/src/apis/auth/checkSignIn.ts index 24055e4..078d228 100644 --- a/src/apis/auth/checkSignIn.ts +++ b/src/apis/auth/checkSignIn.ts @@ -1,12 +1,17 @@ import { NextResponse } from "next/server"; import type { NextRequest } from "next/server"; +import { checkSignUp } from "./checkSignUp"; export async function checkSignIn(request: NextRequest) { const token = request.cookies.get("accessToken")?.value; const url = request.nextUrl.clone(); if (token) { - return NextResponse.next(); + if ("/((?!auth).*)") { + return checkSignUp(request); + } else { + return NextResponse.next(); + } } else { url.pathname = "/account"; return NextResponse.redirect(url); diff --git a/src/hooks/account/useAuth.ts b/src/hooks/account/useAuth.ts index f3e89a5..2b61e39 100644 --- a/src/hooks/account/useAuth.ts +++ b/src/hooks/account/useAuth.ts @@ -22,7 +22,7 @@ export const useAuth = () => { return Promise.reject(error); } ); - router.push("/auth/default"); + router.push("/"); }, onError: (error: any) => { alert(error); @@ -45,7 +45,7 @@ export const useAuth = () => { return Promise.reject(error); } ); - router.push("/auth/default"); + router.push("/"); }, onError: (error: any) => { alert(error); diff --git a/src/hooks/questions/useQsetMutation.ts b/src/hooks/questions/useQsetMutation.ts index d55b3af..3074bd6 100644 --- a/src/hooks/questions/useQsetMutation.ts +++ b/src/hooks/questions/useQsetMutation.ts @@ -11,11 +11,7 @@ const useQsetMutation = () => { onSuccess: () => { queryClient.invalidateQueries(QSetCursorKeys.all); }, - onError: (error: any) => { - if (error === "AxiosError: Request failed with status code 404") { - return 0; - } - } + onError: (error: any) => {} }); }; diff --git a/src/middleware.ts b/src/middleware.ts index ad01756..198731f 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -1,6 +1,5 @@ import { NextResponse } from "next/server"; import type { NextRequest } from "next/server"; -import { checkSignUp } from "./apis/auth/checkSignUp"; import { checkSignIn } from "./apis/auth/checkSignIn"; import { qFeedAxios } from "./apis/axios"; @@ -11,10 +10,8 @@ export async function middleware(request: NextRequest) { const requestHeaders = new Headers(request.headers); requestHeaders.set("Authorization", `Bearer ${token}`); - if (pathname.match("/((?!account|auth).*)")) { + if (pathname.match("/((?!account).*)")) { return await checkSignIn(request); - } else if (pathname.match("/((?!account).*)")) { - return await checkSignUp(request); } return NextResponse.next(); diff --git a/src/pages-edit/home/components/MakeOfficial.tsx b/src/pages-edit/home/components/MakeOfficial.tsx index 6e4ee3f..91a5c28 100644 --- a/src/pages-edit/home/components/MakeOfficial.tsx +++ b/src/pages-edit/home/components/MakeOfficial.tsx @@ -27,53 +27,54 @@ const MakeOfficial = (props: QuestionProps) => { const QSet = useQsetCursorQuery(); const newQSet = useQsetMutation(); - console.log(QSet); - const [endTime, setEndTime] = useState(NaN); const [time, setTime] = useState