From 0d674c06334f9736be3a8cfed3bd976327d850c2 Mon Sep 17 00:00:00 2001 From: Seogeurim Date: Sat, 18 Dec 2021 02:03:03 +0900 Subject: [PATCH] =?UTF-8?q?[#60]=20feat:=20Service=20API=20=EB=AA=A8?= =?UTF-8?q?=EB=93=88=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Service 관련 type 정의 - ServiceAPI 클래스 정의 --- src/apis/index.ts | 5 ++++- src/apis/serviceApi/index.ts | 13 +++++++++++++ src/types/index.ts | 1 + src/types/service.ts | 11 +++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/apis/serviceApi/index.ts create mode 100644 src/types/service.ts diff --git a/src/apis/index.ts b/src/apis/index.ts index 4f7071a..018ee03 100644 --- a/src/apis/index.ts +++ b/src/apis/index.ts @@ -1,6 +1,8 @@ +import { createAxiosHTTPClient } from '@/utils/httpClient'; + import AuthApi from './authApi'; +import ServiceApi from './serviceApi'; import UserApi from './userApi'; -import { createAxiosHTTPClient } from '@/utils/httpClient'; const getApiBaseURL = (): string => { return process.env.APP_API_URL ?? '/'; @@ -11,3 +13,4 @@ const client = createAxiosHTTPClient({ baseURL, withCredentials: true }); export const authApi = new AuthApi(client, '/api/auth'); export const userApi = new UserApi(client, '/api/users'); +export const serviceApi = new ServiceApi(client, '/api/projects'); diff --git a/src/apis/serviceApi/index.ts b/src/apis/serviceApi/index.ts new file mode 100644 index 0000000..352e2a9 --- /dev/null +++ b/src/apis/serviceApi/index.ts @@ -0,0 +1,13 @@ +import { ServiceListAndCountResponseBody } from '@/types'; + +import Api from '../api'; + +class ServiceApi extends Api { + async getListAndCount(): Promise { + const response = await this.get(); + + return response.data; + } +} + +export default ServiceApi; diff --git a/src/types/index.ts b/src/types/index.ts index a0032eb..82ac873 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,2 +1,3 @@ export * from './auth'; export * from './user'; +export * from './service'; diff --git a/src/types/service.ts b/src/types/service.ts new file mode 100644 index 0000000..6585d23 --- /dev/null +++ b/src/types/service.ts @@ -0,0 +1,11 @@ +export type ServiceBasicInfo = { + id: number; + name: string; + clientId: string; + domain: string | null; +}; + +export type ServiceListAndCountResponseBody = { + projectList: ServiceBasicInfo[]; + count: number; +};