-
Notifications
You must be signed in to change notification settings - Fork 3
Merge develop → main: UI 메뉴 활성화 로직 개선 및 버그 수정 #545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
688f54d
eec03af
24117ad
656df24
b4885d8
171d3ad
02399a9
75c748a
1fc774a
3b59cbe
3a9e47c
83fe875
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,7 @@ import type { | |||||
| OrderType, | ||||||
| StorePaymentsResponse, | ||||||
| } from "../types/order/order"; | ||||||
|
|
||||||
| const API_URI = import.meta.env.VITE_SERVER_URI; | ||||||
|
|
||||||
| const api = axios.create({ | ||||||
|
|
@@ -20,7 +21,7 @@ export const createOrder = async ( | |||||
| payload: OrderType | ||||||
| ): Promise<CreateOrderServerResponse> => { | ||||||
| const res = await api.post( | ||||||
| `/orders/create/${publicCode}/${tableId}`, | ||||||
| `v1/stores/${publicCode}/tables/${tableId}/orders`, | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Missing leading slash in URL path. The path 🔎 Proposed fix- `v1/stores/${publicCode}/tables/${tableId}/orders`,
+ `/v1/stores/${publicCode}/tables/${tableId}/orders`,📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| payload | ||||||
| ); | ||||||
| return res.data; | ||||||
|
|
@@ -31,15 +32,15 @@ export const getOrderDetails = async ( | |||||
| publicCode: string, | ||||||
| tableId: number | ||||||
| ): Promise<OrderDetailsServerResponse> => { | ||||||
| const res = await api.get(`/orders/items/${publicCode}/${tableId}`); | ||||||
| const res = await api.get(`v1/stores/${publicCode}/tables/${tableId}/orders`); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Missing leading slash in URL path. The path 🔎 Proposed fix- const res = await api.get(`v1/stores/${publicCode}/tables/${tableId}/orders`);
+ const res = await api.get(`/v1/stores/${publicCode}/tables/${tableId}/orders`);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| return res.data; | ||||||
| }; | ||||||
|
|
||||||
| //주점 QR, 계좌번호 조회 | ||||||
| export const getStorePayments = async (publicCode: string) => { | ||||||
| try { | ||||||
| const res = await axios.get<StorePaymentsResponse>( | ||||||
| `${API_URI}/v1/store-payments/${publicCode}` | ||||||
| `${API_URI}/v1/stores/${publicCode}/payments` | ||||||
| ); | ||||||
| return res.data; | ||||||
| } catch (error) { | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -14,7 +14,7 @@ interface ServerResponse { | |||||
|
|
||||||
| // 모든 주점 정보 가져오기 | ||||||
| export const getAllStores = async () => { | ||||||
| const response = await UserApi.get<ServerResponse>("/v1/stores/all-stores", { | ||||||
| const response = await UserApi.get<ServerResponse>("/v1/stores", { | ||||||
| params: { | ||||||
| page: 0, | ||||||
| size: 50, | ||||||
|
|
@@ -27,7 +27,7 @@ export const getAllStores = async () => { | |||||
| export const getInfiniteAllStores = async ( | ||||||
| pageParam: number | ||||||
| ): Promise<{ storePageReadResponses: StoreType[]; hasNext: boolean }> => { | ||||||
| const response = await UserApi.get<ServerResponse>("/v1/stores/all-stores", { | ||||||
| const response = await UserApi.get<ServerResponse>("/v1/stores", { | ||||||
| params: { | ||||||
| page: pageParam, | ||||||
| size: 5, | ||||||
|
|
@@ -52,20 +52,20 @@ export const createReservation = async ( | |||||
| payload: { partySize: number } | ||||||
| ) => { | ||||||
| const res = await UserApi.post( | ||||||
| `/reservations/create/redis/${storeId}`, | ||||||
| `v1/users/me/waitings/${storeId}`, | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Missing leading slash in URL path. The path 🔎 Proposed fix- `v1/users/me/waitings/${storeId}`,
+ `/v1/users/me/waitings/${storeId}`,📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| payload | ||||||
| ); | ||||||
| return res.data; | ||||||
| }; | ||||||
|
|
||||||
| export const getMyReservations = async () => { | ||||||
| const res = await UserApi.get("/reservations/my/waitings"); | ||||||
| const res = await UserApi.get("/v1/users/me/waitings"); | ||||||
| return res.data; | ||||||
| }; | ||||||
|
|
||||||
| // 북마크 조회 | ||||||
| export const getBookmark = async (): Promise<BookmarkResponse> => { | ||||||
| const res = await UserApi.get("/bookmarks"); | ||||||
| const res = await UserApi.get("/v1/users/me/bookmarks"); | ||||||
| return res.data; | ||||||
| }; | ||||||
|
|
||||||
|
|
@@ -74,14 +74,14 @@ export const createBookmark = async ( | |||||
| storeId: number | undefined, | ||||||
| signal: AbortSignal | ||||||
| ) => { | ||||||
| await UserApi.post(`/bookmarks/${storeId}`, null, { signal }); | ||||||
| await UserApi.post(`/v1/users/me/bookmarks/${storeId}`, null, { signal }); | ||||||
| }; | ||||||
|
|
||||||
| // 북마크 삭제 | ||||||
| export const deleteBookmark = async ( | ||||||
| storeId: number | undefined, | ||||||
| signal: AbortSignal | ||||||
| ) => { | ||||||
| const res = await UserApi.delete(`/bookmarks/${storeId}`, { signal }); | ||||||
| const res = await UserApi.delete(`/v1/users/me/bookmarks/${storeId}`, { signal }); | ||||||
| return res.data; | ||||||
| }; | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Avoid mutating the destructured path variable.
Reassigning the
pathvariable that comes from destructuring is confusing and violates clean code principles. Instead, compute the actual path in a separate variable to maintain clarity.Apply this diff to use a separate variable:
{menuItems.map(({ label, icon, activeIcon, path }) => { - //주문의 경우 클릭시 경로에 storeId가 붙기 때문에 추가 검증 + // 주문의 경우 클릭시 경로에 storeId가 붙기 때문에 추가 검증 + const actualPath = label === "주문" ? `/admin/orders/${storeId}` : path; - if (label === "주문") { - path = `/admin/orders/${storeId}`; - } - const isActive = pathname === path; + const isActive = pathname === actualPath; return ( <li key={label} className={`flex items-center gap-3 px-3 py-2 rounded-md text-title-18-semibold ${ isActive ? "bg-[#f5f5f5] text-black" : "text-black-50" }`} - onClick={() => { - navigate(path); - onClose(); - }} + onClick={() => { + navigate(actualPath); + onClose(); + }} >📝 Committable suggestion
🤖 Prompt for AI Agents