Skip to content

Commit

Permalink
[#60] feat: Service API 모듈 생성
Browse files Browse the repository at this point in the history
- Service 관련 type 정의
- ServiceAPI 클래스 정의
  • Loading branch information
Seogeurim committed Dec 17, 2021
1 parent 8e44ab1 commit 0d674c0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/apis/index.ts
Original file line number Diff line number Diff line change
@@ -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 ?? '/';
Expand All @@ -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');
13 changes: 13 additions & 0 deletions src/apis/serviceApi/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ServiceListAndCountResponseBody } from '@/types';

import Api from '../api';

class ServiceApi extends Api {
async getListAndCount(): Promise<ServiceListAndCountResponseBody> {
const response = await this.get<ServiceListAndCountResponseBody>();

return response.data;
}
}

export default ServiceApi;
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './auth';
export * from './user';
export * from './service';
11 changes: 11 additions & 0 deletions src/types/service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export type ServiceBasicInfo = {
id: number;
name: string;
clientId: string;
domain: string | null;
};

export type ServiceListAndCountResponseBody = {
projectList: ServiceBasicInfo[];
count: number;
};

0 comments on commit 0d674c0

Please sign in to comment.