Skip to content

Commit 25ffaca

Browse files
committed
feat: updatePrepared 추가
1 parent 5110603 commit 25ffaca

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

packages/common/src/apis/admin_api.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ namespace BackendAdminAPIs {
4444
(data: Omit<T, "id">) =>
4545
client.patch<T, Omit<T, "id">>(`v1/admin-api/${app}/${resource}/${id}/`, data);
4646

47+
export const updatePrepared =
48+
<T extends { id: string }>(client: BackendAPIClient, app: string, resource: string) =>
49+
(data: T) =>
50+
client.patch<T, Omit<T, "id">>(`v1/admin-api/${app}/${resource}/${data.id}/`, data);
51+
4752
export const remove = (client: BackendAPIClient, app: string, resource: string, id: string) => () =>
4853
client.delete<void>(`v1/admin-api/${app}/${resource}/${id}/`);
4954

packages/common/src/hooks/useAdminAPI.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ namespace BackendAdminAPIHooks {
8787
mutationFn: BackendAdminAPIs.update<T>(client, app, resource, id),
8888
});
8989

90+
export const useUpdatePreparedMutation = <T extends { id: string }>(client: BackendAPIClient, app: string, resource: string) =>
91+
useMutation({
92+
mutationKey: [...MUTATION_KEYS.ADMIN_UPDATE, app, resource, "prepared"],
93+
mutationFn: BackendAdminAPIs.updatePrepared<T>(client, app, resource),
94+
});
95+
9096
export const useRemoveMutation = (client: BackendAPIClient, app: string, resource: string, id: string) =>
9197
useMutation({
9298
mutationKey: [...MUTATION_KEYS.ADMIN_REMOVE, app, resource, id],

0 commit comments

Comments
 (0)