Skip to content

Commit 8339feb

Browse files
committed
🐛 fix: update not-found page retry logic and typing header cursor pointer
1 parent 723dae4 commit 8339feb

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/features/provider/Provider.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
QueryClient,
66
QueryClientProvider,
77
} from "@tanstack/react-query";
8+
import { useRouter } from "next/navigation";
89
import { ReactNode, useState } from "react";
910

1011
// import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
@@ -14,6 +15,7 @@ type Props = {
1415
};
1516

1617
const Providers = ({ children }: Props) => {
18+
const router = useRouter();
1719
const [client] = useState(
1820
new QueryClient({
1921
defaultOptions: {
@@ -27,8 +29,10 @@ const Providers = ({ children }: Props) => {
2729
onError: (error, query) => {
2830
if (query.meta && query.meta.errorMessage) {
2931
console.error(`${query.meta.errorMessage}`);
32+
router.push("/not-found");
3033
} else {
3134
console.error(`Something went wrong: ${error.message}`);
35+
router.push("/not-found");
3236
}
3337
},
3438
}),

src/features/typing/ui/NotFoundTyping/NotFoundTyping.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
import { Button } from "@/shared/ui";
44
import Image from "next/image";
5+
import { useRouter } from "next/navigation";
6+
import { useState } from "react";
57

68
const NotFoundTyping = () => {
9+
const [isRouterBack, setIsRouterBack] = useState(false);
10+
const router = useRouter();
711
return (
812
<div className="flex flex-col items-center justify-center text-center w-full min-h-[calc(100vh_-_68px)] gap-5">
913
<div>
@@ -23,7 +27,13 @@ const NotFoundTyping = () => {
2327
<div>
2428
<Button
2529
className="bg-black rounded-[100px]"
26-
onClick={() => window.location.reload()}
30+
onClick={() => {
31+
router.back();
32+
setIsRouterBack(true);
33+
if (isRouterBack) {
34+
window.location.reload();
35+
}
36+
}}
2737
>
2838
다시 시도
2939
</Button>

src/shared/ui/Header/TypingHeader/TypingHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const TypingHeader = () => {
111111
)}
112112
<div className="text-lg font-black cursor-pointer">{renderTitle()}</div>
113113
{isRenderLogin() && (
114-
<div className="w-6">
114+
<div className="w-6 cursor-pointer">
115115
<div onClick={() => router.push("/login")}>
116116
<TbLogin2 size={24} />
117117
</div>

0 commit comments

Comments
 (0)