Skip to content

Commit

Permalink
fix: login axios
Browse files Browse the repository at this point in the history
  • Loading branch information
esthel7 committed Nov 30, 2023
1 parent 61e987a commit 8995795
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion front/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ const App = () => {
</IsLogin>
}
>
<Route path="" element={<Nickname />} />
<Route path="" element={<></>} />
<Route path="nickname" element={<Nickname />} />
<Route path="snowball" element={<Snowball />} />
<Route path="maindeco" element={<MainDeco />} />
</Route>
Expand Down
7 changes: 6 additions & 1 deletion front/src/router/IsLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ const IsLogin: React.FC<{ children: ReactNode }> = ({ children }) => {
const navigate = useNavigate();
const [url, setUrl] = React.useState<string>('');

// const cookieToken = import.meta.env.VITE_APP_COOKIE_TOKEN;

useEffect(() => {
if (url === '') {
axios
.get('/api/user', {
withCredentials: true
withCredentials: true // axios 쿠키 값 전달
// headers: {
// Authorization: `Bearer ${cookieToken}` // temporary
// }
})
.then(res => {
if (res.status === 200) {
Expand Down

0 comments on commit 8995795

Please sign in to comment.