diff --git a/src/hooks/queries/useDeleteUser.tsx b/src/hooks/queries/useDeleteUser.tsx
index 55d011e..caf7a61 100644
--- a/src/hooks/queries/useDeleteUser.tsx
+++ b/src/hooks/queries/useDeleteUser.tsx
@@ -3,6 +3,7 @@ import user from '../../apis/user';
export const useDeleteUser = () => {
const deleteUser = async (accessToken: string) => {
+ console.log('clicked?');
const navigate = useNavigate();
try {
await user.deleteUser(accessToken);
diff --git a/src/hooks/queries/useGetToken.tsx b/src/hooks/queries/useGetToken.tsx
index 434a141..353b296 100644
--- a/src/hooks/queries/useGetToken.tsx
+++ b/src/hooks/queries/useGetToken.tsx
@@ -1,22 +1,27 @@
import axios from 'axios';
-import { REDIRECT_URI, REST_API_KEY } from '../../utils/login';
+import { REDIRECT_URI, REST_API_KEY, CLIENT_SECRET } from '../../utils/login';
const useGetToken = async () => {
const code = new URL(window.location.href).searchParams.get('code');
- const res = axios.post(
- 'https://kauth.kakao.com/oauth/token',
- {
- grant_type: 'authorization_code',
- client_id: REST_API_KEY,
- redirect_uri: REDIRECT_URI,
- code: code,
+
+ if (!code) {
+ throw new Error('Authorization code not found');
+ }
+
+ const params = new URLSearchParams();
+ params.append('grant_type', 'authorization_code');
+ params.append('client_id', REST_API_KEY);
+ params.append('redirect_uri', REDIRECT_URI);
+ params.append('code', code);
+ if (CLIENT_SECRET) {
+ params.append('client_secret', CLIENT_SECRET);
+ }
+
+ const res = axios.post('https://kauth.kakao.com/oauth/token', params, {
+ headers: {
+ 'Content-type': 'application/x-www-form-urlencoded;charset=utf-8',
},
- {
- headers: {
- 'Content-type': 'application/x-www-form-urlencoded;charset=utf-8',
- },
- }
- );
+ });
return res;
};
export default useGetToken;
diff --git a/src/layouts/DeleteLayout.tsx b/src/layouts/DeleteLayout.tsx
new file mode 100644
index 0000000..9ed2049
--- /dev/null
+++ b/src/layouts/DeleteLayout.tsx
@@ -0,0 +1,50 @@
+import styled from 'styled-components';
+import { IcFeelingLBlank, IcPcBlank, IcPcRecordream } from '../assets/svg';
+import Button from '../components/Button';
+import { Outlet } from 'react-router-dom';
+import { useDeleteUser } from '../hooks/queries/useDeleteUser';
+
+interface DeleteLayoutInterface {
+ iconOn: boolean;
+ btnColor: string;
+ btnMessage: string;
+}
+
+const DeleteLayout = ({ iconOn, btnColor, btnMessage }: DeleteLayoutInterface) => {
+ const { deleteUser } = useDeleteUser();
+ const accessToken = localStorage.getItem('accessToken');
+
+ console.log('ACCESSTOKEn', accessToken);
+ if (!accessToken) {
+ console.error('Access token is missing');
+ return null;
+ }
+
+ const handleDeleteUser = () => {
+ deleteUser(accessToken);
+ };
+
+ return (
+
+
+ {iconOn ? (
+
+ ) : (
+
+ )}
+
+
+
+ );
+};
+
+export default DeleteLayout;
+
+const RecordreamLayoutWrapper = styled.div`
+ height: 100dvh;
+
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+`;
diff --git a/src/pages/RecordreamLayout.tsx b/src/layouts/RecordreamLayout.tsx
similarity index 92%
rename from src/pages/RecordreamLayout.tsx
rename to src/layouts/RecordreamLayout.tsx
index 50b79ab..8bdf3d4 100644
--- a/src/pages/RecordreamLayout.tsx
+++ b/src/layouts/RecordreamLayout.tsx
@@ -25,7 +25,7 @@ const RecordreamLayout = ({
)}
-
+