diff --git a/public/assets/icon16/arrow_square_16.svg b/public/assets/icon16/arrow_square_16.svg
new file mode 100644
index 00000000..e5f1521d
--- /dev/null
+++ b/public/assets/icon16/arrow_square_16.svg
@@ -0,0 +1,4 @@
+
diff --git a/src/app/settings/layout.tsx b/src/app/settings/layout.tsx
index 7811a1e0..a7797995 100644
--- a/src/app/settings/layout.tsx
+++ b/src/app/settings/layout.tsx
@@ -7,7 +7,9 @@ interface TermsLayoutProps {
export default function layout({ children }: TermsLayoutProps) {
return (
);
diff --git a/src/app/settings/page.tsx b/src/app/settings/page.tsx
index 30968d37..86c9d30d 100644
--- a/src/app/settings/page.tsx
+++ b/src/app/settings/page.tsx
@@ -4,24 +4,35 @@ import { useRouter } from 'next/navigation';
import { SETTINGS, Setting } from '@constants/settings';
import RightArrowIcon from 'public/assets/icon24/right_arrow_24.svg';
+import ArrowSquareIcon from 'public/assets/icon16/arrow_square_16.svg';
+import { useLogout } from '@hooks/api/useLogout';
export default function Page() {
const { push } = useRouter();
+ const { mutate: logout } = useLogout();
const handleClickSettingItem = (setting: Setting) => () => {
if (setting.url) {
push(setting.url);
}
+
+ if (setting.title === '로그아웃') {
+ logout();
+ }
};
+
return (
{SETTINGS.map((setting, index) => (
-
-
{setting.title}
+
+
{setting.title}
+ {setting.url &&
}
+
{setting.url && }
))}
diff --git a/src/hooks/api/useLogout.ts b/src/hooks/api/useLogout.ts
new file mode 100644
index 00000000..38830a7a
--- /dev/null
+++ b/src/hooks/api/useLogout.ts
@@ -0,0 +1,19 @@
+import { useMutation, UseMutationResult } from '@tanstack/react-query';
+import { AxiosError } from 'axios';
+import Cookies from 'js-cookie';
+import { useRouter } from 'next/navigation';
+
+import { logout } from '@utils/auth';
+
+export const useLogout = (): UseMutationResult => {
+ const { push } = useRouter();
+ return useMutation({
+ mutationKey: ['logout'],
+ mutationFn: logout,
+ onSuccess: () => {
+ Cookies.remove('accessToken');
+ Cookies.remove('refreshToken');
+ push('/login');
+ },
+ });
+};