Skip to content

Commit 7cce71f

Browse files
committed
fix: 로그인 분기 수정 & 회원 가입 시 json으로 전송
1 parent 489437e commit 7cce71f

File tree

4 files changed

+18
-29
lines changed

4 files changed

+18
-29
lines changed

src/App.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
'use client';
2-
import { router } from '@/routes/router';
3-
import { refreshAuthAtom } from '@/store/auth';
4-
import { useSetAtom } from 'jotai';
5-
import { useEffect } from 'react';
2+
63
import { RouterProvider } from 'react-router-dom';
74

5+
import { router } from '@/routes/router';
6+
87
export const App = () => {
9-
const refreshAuth = useSetAtom(refreshAuthAtom);
8+
// const refreshAuth = useSetAtom(refreshAuthAtom);
109

11-
useEffect(() => {
12-
refreshAuth();
13-
}, []);
10+
// useEffect(() => {
11+
// refreshAuth();
12+
// }, []);
1413

1514
return <RouterProvider router={router} />;
16-
};
15+
};

src/api/apiInstance.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ apiInstance.interceptors.response.use(
116116
})
117117
.catch((reissueError: AxiosError) => {
118118
processQueue(reissueError);
119-
navigate(PATH.LOGIN);
119+
// navigate(PATH.LOGIN);
120120

121121
console.error('reissue error', reissueError);
122122
return Promise.reject(reissueError);
@@ -128,7 +128,6 @@ apiInstance.interceptors.response.use(
128128

129129
// 리프레시 토큰이 만료됨
130130
// sessionStorage.removeItem('Authorization');
131-
navigate(PATH.LOGIN);
132131
return Promise.reject(error);
133132
}
134133
}

src/api/user.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,10 @@ export const createProfile = async ({
2323
memberExplain,
2424
image,
2525
}: ProfileMutationArgs) => {
26-
const formData = new FormData();
27-
28-
formData.append('memberName', memberName);
29-
formData.append('memberExplain', memberExplain);
30-
if (image) {
31-
formData.append('image', image);
32-
}
33-
34-
const res = await apiInstance.post('v1/members', formData, {
35-
headers: {
36-
'Content-Type': 'multipart/form-data',
37-
},
26+
const res = await apiInstance.post('v1/members', {
27+
memberName,
28+
memberExplain,
29+
image,
3830
});
3931

4032
return res.data;

src/routes/router.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,20 @@ import { useAtom } from 'jotai';
3030

3131
const useAuth = () => {
3232
const [isLoggedIn] = useAtom(isLoggedInAtom);
33+
console.log('useAuth isLoggedIn', isLoggedIn);
3334
// if (isDevMode()) {
3435
// return {
3536
// isAuthenticated: true,
3637
// };
3738
// }
38-
console.log('isLoggedIn', isLoggedIn);
3939
return {
4040
isAuthenticated: isLoggedIn,
4141
};
4242
};
4343

4444
const PrivateRoute = ({ children }: { children: React.ReactNode }) => {
4545
const { isAuthenticated } = useAuth();
46+
console.log('PrivateRoute isAuthenticated', isAuthenticated);
4647
const location = useLocation();
4748

4849
if (!isAuthenticated) {
@@ -113,11 +114,9 @@ export const router = createBrowserRouter(
113114
{
114115
path: PATH.ENROLL,
115116
element: (
116-
<PrivateRoute>
117-
<Suspense fallback={<LazySkeleton />}>
118-
<LazyEnrollTemplate />
119-
</Suspense>
120-
</PrivateRoute>
117+
<Suspense fallback={<LazySkeleton />}>
118+
<LazyEnrollTemplate />
119+
</Suspense>
121120
),
122121
},
123122
{

0 commit comments

Comments
 (0)