fix. 코드 리팩토링, 워닝 수정
This commit is contained in:
45
layers/types/api/common.ts
Normal file
45
layers/types/api/common.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* 공통 API 타입 정의
|
||||
*/
|
||||
|
||||
// HTTP 메소드 타입
|
||||
export type HttpMethod =
|
||||
| 'GET'
|
||||
| 'HEAD'
|
||||
| 'PATCH'
|
||||
| 'POST'
|
||||
| 'PUT'
|
||||
| 'DELETE'
|
||||
| 'CONNECT'
|
||||
| 'OPTIONS'
|
||||
| 'TRACE'
|
||||
|
||||
// 공통 Fetch 옵션 타입
|
||||
export interface FetchOptions {
|
||||
query?: object | null
|
||||
headers?: object | null
|
||||
body?: object | null
|
||||
key?: string | null
|
||||
loading?: { localId?: string } | boolean
|
||||
}
|
||||
|
||||
// Fetch 요청 옵션 타입
|
||||
export interface FetchRequestOptions {
|
||||
method: HttpMethod
|
||||
headers: Record<string, string>
|
||||
query?: object
|
||||
body?: object
|
||||
key?: string
|
||||
}
|
||||
|
||||
export interface FetchErrorObject {
|
||||
data?: unknown
|
||||
statusCode?: number
|
||||
statusMessage?: string
|
||||
}
|
||||
|
||||
// 요청 객체 타입 (IP 조회용)
|
||||
export interface RequestObject {
|
||||
headers: Record<string, string>
|
||||
socket: { remoteAddress?: string }
|
||||
}
|
||||
Reference in New Issue
Block a user