Skip to content

Commit 6e8390e

Browse files
authored
[Setting/#130] ESLint warning 정리 및 any 타입 제거 리팩토링 (#133)
* fix:any타입 에러 수정중 * fix: lint 에러 수정중(중간저장목적) * fix: lint에러 수정중(중간저장목적) * fix: lint에러 수정중 중간 저장 * fix: lint에러 수정중 중간점검 * fix: lint 에러 수정완료 * fix: build 에러 수정 * fix: 코드래빗 수정사항 반영 * fix: 화면 오류확인해서 삭제했던 globals.css 복구 * fix: 코드래빗 수정사항 반영
1 parent c5e5955 commit 6e8390e

49 files changed

Lines changed: 766 additions & 519 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/api/axios.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,20 @@ api.interceptors.request.use((config: InternalAxiosRequestConfig) => {
3636

3737
let refreshPromise: ReturnType<typeof postRefresh> | null = null;
3838

39+
type ApiResponseWithFlags = {
40+
code?: string;
41+
message?: string;
42+
success?: boolean;
43+
isSuccess?: boolean;
44+
};
45+
3946
api.interceptors.response.use(
4047
(res) => {
4148
const data = res.data;
4249
if (isApiResponse(data)) {
50+
const responseData: ApiResponseWithFlags = data;
4351
const failed =
44-
(typeof (data as any).success === "boolean" &&
45-
(data as any).success === false) ||
46-
(typeof (data as any).isSuccess === "boolean" &&
47-
(data as any).isSuccess === false);
52+
responseData.success === false || responseData.isSuccess === false;
4853

4954
if (failed) {
5055
return Promise.reject({

src/api/bookings.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { api } from "./axios";
22

3-
type ApiBookingStatus = "CONFIRMED" | "COMPLETED" | "CANCELED";
3+
type ApiBookingStatus = "PENDING" | "CONFIRMED" | "COMPLETED" | "CANCELED";
44

55
interface Booking {
66
bookingId: number;
@@ -9,7 +9,8 @@ interface Booking {
99
bookingDate: string;
1010
bookingTime: string;
1111
partySize: number;
12-
amount: number;
12+
tableNumbers: string;
13+
amount: number | null;
1314
paymentMethod: string;
1415
status: ApiBookingStatus;
1516
}
@@ -23,11 +24,16 @@ interface BookingResponse {
2324
isLast: boolean;
2425
}
2526

27+
type GetBookingParams = {
28+
page: number;
29+
status?: ApiBookingStatus;
30+
};
31+
2632
export const getBookings = async (
2733
status?: ApiBookingStatus,
2834
page: number = 1,
2935
): Promise<BookingResponse> => {
30-
const params: any = { page };
36+
const params: GetBookingParams = { page };
3137
if (status) params.status = status;
3238

3339
const response = await api.get<{ result: BookingResponse }>(

src/api/owner/menus.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import axios from "axios";
12
import { api } from "../axios";
23
import type { ApiResponse } from "@/types/api";
34

@@ -96,12 +97,20 @@ export const deleteMenuImage = async (
9697
`/api/v1/stores/${storeId}/menus/${menuId}/image`,
9798
);
9899
return res.data;
99-
} catch (err: any) {
100+
} catch (err: unknown) {
100101
console.error("deleteMenuImage error", err);
102+
if (axios.isAxiosError(err)) {
103+
return {
104+
isSuccess: false,
105+
code: "_MENU_IMAGE_DELETE_FAILED",
106+
message: err?.response?.data?.message || "이미지 삭제 실패",
107+
result: { deletedImageKey: "" },
108+
};
109+
}
101110
return {
102111
isSuccess: false,
103112
code: "_MENU_IMAGE_DELETE_FAILED",
104-
message: err?.response?.data?.message || "이미지 삭제 실패",
113+
message: "이미지 삭제 실패",
105114
result: { deletedImageKey: "" },
106115
};
107116
}

src/api/owner/storeLayout.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { ApiResponse } from "@/types/api";
22
import { api } from "../axios";
33
import type { SeatsType } from "@/types/table";
4+
import axios from "axios";
45

56
export interface LayoutTable {
67
tableId: number;
@@ -53,8 +54,8 @@ export const getActiveLayout = async (
5354
return null;
5455
}
5556
return null;
56-
} catch (e: any) {
57-
if (e.response?.status === 404) {
57+
} catch (e: unknown) {
58+
if (axios.isAxiosError(e) && e.response?.status === 404) {
5859
console.error("가게를 찾을 수 없음");
5960
} else {
6061
console.error(e);
@@ -97,8 +98,13 @@ export const createTable = async (
9798
}
9899
console.error("테이블 생성 실패 응답:", res.data);
99100
return null;
100-
} catch (e: any) {
101-
console.error("테이블 생성 실패:", e?.response?.data ?? e);
101+
} catch (e: unknown) {
102+
if (axios.isAxiosError(e)) {
103+
console.error("테이블 생성 실패:", e?.response?.data ?? e);
104+
} else {
105+
console.error("테이블 생성 실패:", e);
106+
}
107+
102108
return null;
103109
}
104110
};

src/api/owner/stores.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { api } from "@/api/axios";
22
import type { ApiResponse } from "@/types/api";
3+
import type { UpdateStoreResponse } from "@/types/store";
34

45
interface StoreDetail {
56
storeId: number;
@@ -70,7 +71,10 @@ export function updateStore(
7071
phoneNumber: string;
7172
},
7273
) {
73-
return api.patch<ApiResponse<any>>(`/api/v1/stores/${storeId}`, body);
74+
return api.patch<ApiResponse<UpdateStoreResponse>>(
75+
`/api/v1/stores/${storeId}`,
76+
body,
77+
);
7478
}
7579

7680
export function updateBusinessHours(

src/api/owner/table.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface DeleteTableImageResult {
1111
tableId: number;
1212
}
1313

14-
interface PatchTableRequest {
14+
export interface PatchTableRequest {
1515
tableNumber?: string;
1616
minSeatCount?: number;
1717
maxSeatCount?: number;

src/components/auth/ChangePasswordDiaLog.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useForm } from "react-hook-form";
55
import { z } from "zod";
66
import { Button } from "../ui/button";
77
import { X } from "lucide-react";
8+
import axios from "axios";
89

910
const schema = z
1011
.object({
@@ -43,8 +44,12 @@ export function ChangePasswordDialog({
4344
form.reset();
4445
onOpenChange(false);
4546
},
46-
onError: (e: any) => {
47-
const msg = e?.response?.data?.message ?? "비밀번호 변경에 실패했습니다.";
47+
onError: (e: unknown) => {
48+
let msg = "비밀번호 변경에 실패했습니다.";
49+
50+
if (axios.isAxiosError(e)) {
51+
msg = e.response?.data?.message ?? msg;
52+
}
4853
if (typeof msg === "string" && /|||/.test(msg)) {
4954
form.setError("currentPassword", { type: "server", message: msg });
5055
return;

src/components/auth/SignupDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export function SignupDialog({
8282

8383
return (
8484
<Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>
85-
<DialogContent className="sm:max-w-[500px] max-h-[90vh] overflow-y-auto">
85+
<DialogContent className="sm:max-w-125 max-h-[90vh] overflow-y-auto">
8686
<DialogHeader>
8787
<DialogTitle className="text-center text-2xl font-bold">
8888
회원가입

src/components/auth/WithdrawDialog.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import { Button } from "../ui/button";
66
import { X } from "lucide-react";
77
import { useState } from "react";
88
import { logout as performLogout } from "@/api/auth";
9+
import axios from "axios";
910

10-
function isWithdrawBlockByBookings(e: any) {
11+
function isWithdrawBlockByBookings(e: unknown) {
12+
if (!axios.isAxiosError(e)) return false;
1113
const msg = e?.response?.data?.message;
1214
const result = e?.response?.data?.result;
1315
const code = e?.response?.data?.code;
@@ -56,12 +58,16 @@ export function WithdrawDialog({
5658
onOpenChange(false);
5759
nav("/", { replace: true });
5860
},
59-
onError: (e: any) => {
61+
onError: (e: unknown) => {
6062
if (isWithdrawBlockByBookings(e)) {
6163
setBlocked(true);
6264
return;
6365
}
64-
alert(e?.response?.data?.message ?? "회원 탈퇴에 실패했습니다.");
66+
let msg = "회원 탈퇴에 실패했습니다";
67+
if (axios.isAxiosError(e)) {
68+
msg = e?.response?.data?.message ?? msg;
69+
}
70+
alert(msg);
6571
},
6672
});
6773

src/components/customer-support/SupportHero.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default function SupportHero() {
99

1010
return (
1111
<>
12-
<section className="bg-gradient-to-r from-blue-600 to-blue-700 text-white">
12+
<section className="bg-linear-to-r from-blue-600 to-blue-700 text-white">
1313
<div className="max-w-[1920px] mx-auto p-8 md:p-16 text-center">
1414
<h2 className="text-white mb-4">무엇을 도와드릴까요?</h2>
1515
<p className="text-blue-100 max-w-2xl mx-auto mb-6 break-keep">

0 commit comments

Comments
 (0)