Skip to content

Commit 83fe875

Browse files
authored
Merge pull request #546 from GTable/feat/user/api
feat: api 주소 네임 변경
2 parents 3b59cbe + 3a9e47c commit 83fe875

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

apps/nowait-user/src/api/menu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ interface MenuServerResponse {
2323
export const getStoreMenus = async (publicCode: string) => {
2424
try {
2525
const res = await axios.get<AllMenuServerResponse>(
26-
`${API_URI}/v1/menus/all-menus/stores/${publicCode}`
26+
`${API_URI}/v1/stores/${publicCode}/menus`
2727
);
2828
if (res?.data.success) return res.data;
2929
} catch (error) {
@@ -36,6 +36,6 @@ export const getStoreMenu = async (
3636
publicCode: string,
3737
menuId: number
3838
): Promise<MenuServerResponse> => {
39-
const res = await axios.get(`${API_URI}/v1/menus/${publicCode}/${menuId}`);
39+
const res = await axios.get(`${API_URI}/v1/stores/${publicCode}/menus/${menuId}`);
4040
return res.data;
4141
};

apps/nowait-user/src/api/order.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {
55
OrderType,
66
StorePaymentsResponse,
77
} from "../types/order/order";
8+
89
const API_URI = import.meta.env.VITE_SERVER_URI;
910

1011
const api = axios.create({
@@ -20,7 +21,7 @@ export const createOrder = async (
2021
payload: OrderType
2122
): Promise<CreateOrderServerResponse> => {
2223
const res = await api.post(
23-
`/orders/create/${publicCode}/${tableId}`,
24+
`v1/stores/${publicCode}/tables/${tableId}/orders`,
2425
payload
2526
);
2627
return res.data;
@@ -31,15 +32,15 @@ export const getOrderDetails = async (
3132
publicCode: string,
3233
tableId: number
3334
): Promise<OrderDetailsServerResponse> => {
34-
const res = await api.get(`/orders/items/${publicCode}/${tableId}`);
35+
const res = await api.get(`v1/stores/${publicCode}/tables/${tableId}/orders`);
3536
return res.data;
3637
};
3738

3839
//주점 QR, 계좌번호 조회
3940
export const getStorePayments = async (publicCode: string) => {
4041
try {
4142
const res = await axios.get<StorePaymentsResponse>(
42-
`${API_URI}/v1/store-payments/${publicCode}`
43+
`${API_URI}/v1/stores/${publicCode}/payments`
4344
);
4445
return res.data;
4546
} catch (error) {

apps/nowait-user/src/api/reservation.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface ServerResponse {
1414

1515
// 모든 주점 정보 가져오기
1616
export const getAllStores = async () => {
17-
const response = await UserApi.get<ServerResponse>("/v1/stores/all-stores", {
17+
const response = await UserApi.get<ServerResponse>("/v1/stores", {
1818
params: {
1919
page: 0,
2020
size: 50,
@@ -27,7 +27,7 @@ export const getAllStores = async () => {
2727
export const getInfiniteAllStores = async (
2828
pageParam: number
2929
): Promise<{ storePageReadResponses: StoreType[]; hasNext: boolean }> => {
30-
const response = await UserApi.get<ServerResponse>("/v1/stores/all-stores", {
30+
const response = await UserApi.get<ServerResponse>("/v1/stores", {
3131
params: {
3232
page: pageParam,
3333
size: 5,
@@ -52,20 +52,20 @@ export const createReservation = async (
5252
payload: { partySize: number }
5353
) => {
5454
const res = await UserApi.post(
55-
`/reservations/create/redis/${storeId}`,
55+
`v1/users/me/waitings/${storeId}`,
5656
payload
5757
);
5858
return res.data;
5959
};
6060

6161
export const getMyReservations = async () => {
62-
const res = await UserApi.get("/reservations/my/waitings");
62+
const res = await UserApi.get("/v1/users/me/waitings");
6363
return res.data;
6464
};
6565

6666
// 북마크 조회
6767
export const getBookmark = async (): Promise<BookmarkResponse> => {
68-
const res = await UserApi.get("/bookmarks");
68+
const res = await UserApi.get("/v1/users/me/bookmarks");
6969
return res.data;
7070
};
7171

@@ -74,14 +74,14 @@ export const createBookmark = async (
7474
storeId: number | undefined,
7575
signal: AbortSignal
7676
) => {
77-
await UserApi.post(`/bookmarks/${storeId}`, null, { signal });
77+
await UserApi.post(`/v1/users/me/bookmarks/${storeId}`, null, { signal });
7878
};
7979

8080
// 북마크 삭제
8181
export const deleteBookmark = async (
8282
storeId: number | undefined,
8383
signal: AbortSignal
8484
) => {
85-
const res = await UserApi.delete(`/bookmarks/${storeId}`, { signal });
85+
const res = await UserApi.delete(`/v1/users/me/bookmarks/${storeId}`, { signal });
8686
return res.data;
8787
};

apps/nowait-user/src/hooks/useInfiniteStores.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const fetchStores = async ({
4545
try {
4646
// UserApi 사용으로 헤더 설정 자동화 (인터셉터에서 최신 토큰 처리)
4747
const response = await UserApi.get<ServerResponse>(
48-
"/v1/stores/all-stores",
48+
"/v1/stores",
4949
{
5050
params: {
5151
page: pageParam,

apps/nowait-user/src/hooks/useMyWaitingList.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface MyWaitingResponse {
2929
const fetchMyWaitingList = async (): Promise<MyWaitingStore[]> => {
3030
try {
3131
const response = await UserApi.get<MyWaitingResponse>(
32-
"/reservations/my/waitings"
32+
"/v1/users/me/waitings"
3333
);
3434

3535
console.log("내 대기 목록 서버 응답:", response.data);

apps/nowait-user/src/hooks/useWaitingStores.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const fetchWaitingStores = async (
2626
): Promise<WaitingStore[]> => {
2727
try {
2828
const response = await UserApi.get<WaitingStoresResponse>(
29-
"/v1/stores/waiting-list",
29+
"/v1/stores/waiting-count",
3030
{
3131
params: {
3232
order,

0 commit comments

Comments
 (0)