Skip to content

Commit

Permalink
refactor: main writer response model 추가
Browse files Browse the repository at this point in the history
ref #39
  • Loading branch information
ppark2ya committed Feb 12, 2022
1 parent 4027ddf commit a5d41a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions data/services/services.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios from '~/shared/axios';
import { SuccessResponse } from '~/shared/types';
import {
MainContentsResponse,
Writer,
MainWritersResponse,
ReadingContentsData,
TranslatingContentsData,
FeedContentsData,
Expand Down Expand Up @@ -30,7 +30,7 @@ export async function getMainWriters({
queryKey,
}: InfiniteQueryParam) {
const [url, params] = queryKey as [string, ContentsSearchParams];
const { data } = await axios.get<SuccessResponse<Writer[]>>(url, {
const { data } = await axios.get<SuccessResponse<MainWritersResponse>>(url, {
params: {
...params,
start: pageParam,
Expand Down
8 changes: 4 additions & 4 deletions data/services/services.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { AxiosError } from 'axios';
import { SuccessResponse } from '~/shared/types';
import {
WritingContentsRequest,
Writer,
MainWritersResponse,
ContentsSearchParams,
MainContentsResponse,
TranslatingContentsData,
Expand Down Expand Up @@ -56,13 +56,13 @@ export function useInfinityWriters(
contentsSearchParams: ContentsSearchParams,
options:
| UseInfiniteQueryOptions<
SuccessResponse<Writer[]>,
SuccessResponse<MainWritersResponse>,
AxiosError<unknown>,
SuccessResponse<Writer[]>
SuccessResponse<MainWritersResponse>
>
| undefined = {},
) {
return useInfiniteQuery<SuccessResponse<Writer[]>, AxiosError>(
return useInfiniteQuery<SuccessResponse<MainWritersResponse>, AxiosError>(
['/services/main_writers', contentsSearchParams],
getMainWriters,
{
Expand Down
6 changes: 6 additions & 0 deletions data/services/services.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ export interface MainContentsResponse {
start: number;
}

export interface MainWritersResponse {
mainWriterList: Writer[];
isLast: boolean;
start: number;
}

export interface ContentsSearchParams {
start: number;
count: number;
Expand Down

0 comments on commit a5d41a7

Please sign in to comment.