Skip to content

Commit c64b2ea

Browse files
committed
feat: 후원사 목록 조회 API 추가
1 parent 97ae5db commit c64b2ea

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

packages/common/src/apis/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace BackendAPIs {
55
export const BackendAPIClientError = _BackendAPIClientError;
66
export const listSiteMaps = (client: BackendAPIClient) => () => client.get<BackendAPISchemas.FlattenedSiteMapSchema[]>("v1/cms/sitemap/");
77
export const retrievePage = (client: BackendAPIClient) => (id: string) => client.get<BackendAPISchemas.PageSchema>(`v1/cms/page/${id}/`);
8+
export const listSponsors = (client: BackendAPIClient) => () => client.get<BackendAPISchemas.SponsorSchema[]>("v1/event/sponsor/");
89
}
910

1011
export default BackendAPIs;

packages/common/src/hooks/useAPI.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ namespace BackendAPIHooks {
3333
queryKey: [client.language, ...QUERY_KEYS.PAGE, id],
3434
queryFn: () => BackendAPIs.retrievePage(client)(id),
3535
});
36+
37+
export const useSponsorQuery = (client: BackendAPIClient) =>
38+
useSuspenseQuery({
39+
queryKey: [client.language, "sponsor", "list"],
40+
queryFn: BackendAPIs.listSponsors(client),
41+
});
3642
}
3743

3844
export default BackendAPIHooks;

packages/common/src/schemas/backendAPI.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ namespace BackendAPISchemas {
3131
order: number;
3232
page: string;
3333
hide: boolean;
34+
parent_sitemap: string | null;
3435
children: NestedSiteMapSchema[];
3536
};
3637

@@ -54,6 +55,18 @@ namespace BackendAPISchemas {
5455
sections: SectionSchema[];
5556
};
5657

58+
export type SponsorSchema = {
59+
id: string;
60+
name: string;
61+
order: number;
62+
sponsors: {
63+
id: string;
64+
name: string;
65+
logo: string;
66+
sitemap_id: string | null;
67+
}[];
68+
};
69+
5770
export const isObjectErrorResponseSchema = (obj?: unknown): obj is BackendAPISchemas.ErrorResponseSchema => {
5871
return (
5972
R.isPlainObject(obj) &&

0 commit comments

Comments
 (0)