diff --git a/README.md b/README.md index 58beeac..fcfe8d7 100644 --- a/README.md +++ b/README.md @@ -1,70 +1,7 @@ -# Getting Started with Create React App - -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). - -## Available Scripts - -In the project directory, you can run: - -### `npm start` - -Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in your browser. - -The page will reload when you make changes.\ -You may also see any lint errors in the console. - -### `npm test` - -Launches the test runner in the interactive watch mode.\ -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. - -### `npm run build` - -Builds the app for production to the `build` folder.\ -It correctly bundles React in production mode and optimizes the build for the best performance. - -The build is minified and the filenames include the hashes.\ -Your app is ready to be deployed! - -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. - -### `npm run eject` - -**Note: this is a one-way operation. Once you `eject`, you can't go back!** - -If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. - -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. - -You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. - -## Learn More - -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/). - -### Code Splitting - -This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) - -### Analyzing the Bundle Size - -This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) - -### Making a Progressive Web App - -This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) - -### Advanced Configuration - -This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) - -### Deployment - -This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) - -### `npm run build` fails to minify - -This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) +# msa-fe +## RELEASE +### 0.0.17-rc4 +* refresh token 없으면 자동 로그아웃 되도록 변경. +* lucide-react 라이브러리 추가. + ```npm install lucide-react``` +* Navbar 반응형 적용 \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index f919b93..0cacfe7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@testing-library/user-event": "^13.5.0", "axios": "^1.8.4", "echarts": "^5.6.0", + "lucide-react": "^0.516.0", "react": "^19.1.0", "react-dom": "^19.1.0", "react-router-dom": "^7.5.1", @@ -11302,6 +11303,15 @@ "yallist": "^3.0.2" } }, + "node_modules/lucide-react": { + "version": "0.516.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.516.0.tgz", + "integrity": "sha512-aybBJzLHcw1CIn3rUcRkztB37dsJATtpffLNX+0/w+ws2p21nYIlOwX/B5fqxq8F/BjqVemnJX8chKwRidvROg==", + "license": "ISC", + "peerDependencies": { + "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, "node_modules/lz-string": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", diff --git a/package.json b/package.json index fb362be..c57f35c 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "@testing-library/user-event": "^13.5.0", "axios": "^1.8.4", "echarts": "^5.6.0", + "lucide-react": "^0.516.0", "react": "^19.1.0", "react-dom": "^19.1.0", "react-router-dom": "^7.5.1", diff --git a/src/api/attachInterceptors.js b/src/api/attachInterceptors.js index 207804b..8d5f379 100644 --- a/src/api/attachInterceptors.js +++ b/src/api/attachInterceptors.js @@ -15,25 +15,34 @@ export const attachAuthInterceptors = (axiosInstance, logout) => { async err => { const originalRequest = err.config; - if ( - err.response?.status === 401 && - !originalRequest._retry && - localStorage.getItem('refresh') - ) { - originalRequest._retry = true; + const is401 = err.response?.status === 401; + const hasRefresh = !!localStorage.getItem('refresh'); - try { - const newAccess = await refreshAccessToken(); - originalRequest.headers.Authorization = `Bearer ${newAccess}`; - return axiosInstance(originalRequest); - } catch (refreshError) { - console.error('토큰 갱신 실패', refreshError); - if (logout) logout(); // ✅ Context logout 반영 - window.location.href = '/login'; + console.log("📌 401 감지됨?", is401); + console.log("📌 refresh 있음?", hasRefresh); + console.log("📌 originalRequest._retry", originalRequest._retry); + + if (is401 && !originalRequest._retry) { + if (hasRefresh) { + originalRequest._retry = true; + try { + const newAccess = await refreshAccessToken(); + originalRequest.headers.Authorization = `Bearer ${newAccess}`; + return axiosInstance(originalRequest); + } catch (refreshError) { + console.error("❌ 토큰 갱신 실패", refreshError); + } } + + // ✅ refresh 없거나, 갱신 실패 시 모두 여기서 logout + console.warn("❌ refresh 없음 또는 갱신 실패 - 로그아웃 진행"); + localStorage.removeItem('access'); + localStorage.removeItem('refresh'); + logout?.(); + window.location.href = '/login'; } return Promise.reject(err); } ); -}; +}; \ No newline at end of file diff --git a/src/components/Navbar.js b/src/components/Navbar.js index f0c18b5..de104b9 100644 --- a/src/components/Navbar.js +++ b/src/components/Navbar.js @@ -1,11 +1,13 @@ -import React from "react"; +import React, { useState } from "react"; import { Link, useNavigate, useLocation } from "react-router-dom"; import { useAuth } from "../context/AuthContext"; +import { Menu, X } from "lucide-react"; const Navbar = () => { const navigate = useNavigate(); const location = useLocation(); const { isLoggedIn, logout, user } = useAuth(); + const [mobileOpen, setMobileOpen] = useState(false); const isHome = location.pathname === "/"; @@ -14,68 +16,111 @@ const Navbar = () => { { name: "about", path: "/about" }, { name: "posts", path: "/posts" }, { name: "boards", path: "/boards" }, - ...(isLoggedIn ? [ - { name: "tasks", path: "/tasks" }, - { name: "ansible", path: "/ansible" }, - ] : []), + ...(isLoggedIn + ? [ + { name: "tasks", path: "/tasks" }, + { name: "ansible", path: "/ansible" }, + ] + : []), ]; return ( ); }; -export default Navbar; +export default Navbar; \ No newline at end of file diff --git a/version b/version index e92a7b7..b549514 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.0.17-rc3 \ No newline at end of file +0.0.17-rc4 \ No newline at end of file