Skip to content

Commit

Permalink
refactor: use arrow function in http
Browse files Browse the repository at this point in the history
  • Loading branch information
gwansikk committed Nov 15, 2024
1 parent be10322 commit 512d1b0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions apps/community/src/utils/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,30 @@ async function request<Response>({
}

const http = {
get: async function get<Response = unknown>(
get: async <Response = unknown>(
url: string,
options?: RequestInit,
): Promise<BaseResponse<Response>> {
): Promise<BaseResponse<Response>> => {
return request<Response>({ method: 'GET', url, options });
},
post: async function post<Request, Response = unknown>(
post: async <Request, Response = unknown>(
url: string,
data?: Request,
options?: RequestInit,
): Promise<BaseResponse<Response>> {
): Promise<BaseResponse<Response>> => {
return request<Response>({ method: 'POST', url, options, data });
},
put: async function put<Request = unknown, Response = unknown>(
put: async <Request = unknown, Response = unknown>(
url: string,
data?: Request,
options?: RequestInit,
): Promise<BaseResponse<Response>> {
): Promise<BaseResponse<Response>> => {
return request<Response>({ method: 'PUT', url, options, data });
},
delete: async function deleteMethod<Response = unknown>(
delete: async <Response = unknown>(
url: string,
options?: RequestInit,
): Promise<BaseResponse<Response>> {
): Promise<BaseResponse<Response>> => {
return request<Response>({ method: 'DELETE', url, options });
},
};
Expand Down

0 comments on commit 512d1b0

Please sign in to comment.