From 46231ecf575b5b7212eb07db1b1bf40fd3593ded Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 10 Oct 2021 17:11:17 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Make=20destroy=20non-generic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/hooks/useViewSet.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/hooks/useViewSet.ts b/frontend/src/hooks/useViewSet.ts index 09b491b..988759f 100644 --- a/frontend/src/hooks/useViewSet.ts +++ b/frontend/src/hooks/useViewSet.ts @@ -11,7 +11,7 @@ export type ViewSetList = (config?: AxiosRequestConfig) => Promise = (pk: string, config?: AxiosRequestConfig) => Promise export type ViewSetCreate = (config?: AxiosRequestConfigWithData) => Promise export type ViewSetUpdate = (pk: string, config?: AxiosRequestConfigWithData) => Promise -export type ViewSetDestroy = (pk: string, config?: AxiosRequestConfig) => Promise +export type ViewSetDestroy = (pk: string, config?: AxiosRequestConfig) => Promise /** @@ -69,7 +69,7 @@ export interface ViewSet { * @param pk - The primary key of the resource to destroy. * @param config - Additional config parameters to use in the request. */ - destroy: ViewSetDestroy, + destroy: ViewSetDestroy, } @@ -143,12 +143,12 @@ export function useViewSet(baseRoute: string): ViewSet { [action, baseRoute] ) - const destroy: ViewSetDestroy = + const destroy: ViewSetDestroy = React.useCallback( async (pk, config) => { await action({...config, url: `${baseRoute}${pk}/`, method: "DELETE"}) }, - [action, baseRoute] + [action, baseRoute], ) return {command, action, list, retrieve, create, update, destroy}