From 1be5584de96e6a5fabe01bcd80522d2ab7f5afbd Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 23 May 2021 18:24:24 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=8A=20Renamed=20inner=20`resources`=20?= =?UTF-8?q?variable=20to=20`res`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nest_frontend/hooks/useBackendViewset.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nest_frontend/hooks/useBackendViewset.js b/nest_frontend/hooks/useBackendViewset.js index 5be7a79..21fe428 100644 --- a/nest_frontend/hooks/useBackendViewset.js +++ b/nest_frontend/hooks/useBackendViewset.js @@ -114,7 +114,7 @@ export default function useBackendViewset(resourcesPath, pkName, const retrieveResource = useCallback( async (pk) => { const refreshedResource = await apiRetrieve(pk) - setResources(resources => resources.map(resource => { + setResources(res => res.map(resource => { if(resource[pkName] === pk) { return refreshedResource } @@ -128,7 +128,7 @@ export default function useBackendViewset(resourcesPath, pkName, const createResource = useCallback( async (data) => { const newResource = await apiCreate(data) - setResources(resources => [...resources, newResource]) + setResources(res => [...res, newResource]) return newResource }, [apiCreate], @@ -137,7 +137,7 @@ export default function useBackendViewset(resourcesPath, pkName, const editResource = useCallback( async (pk, data) => { const editedResource = await apiEdit(pk, data) - setResources(resources => resources.map(resource => { + setResources(res => res.map(resource => { if(resource[pkName] === pk) { return editedResource } @@ -151,7 +151,7 @@ export default function useBackendViewset(resourcesPath, pkName, const destroyResource = useCallback( async (pk) => { await apiDestroy(pk) - setResources(resources => resources.filter(resource => resource[pkName] !== pk)) + setResources(res => res.filter(resource => resource[pkName] !== pk)) return null }, [apiDestroy, pkName],