1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-22 04:54:18 +00:00

🧊 Remove redundant return awaits

This commit is contained in:
Steffo 2021-05-23 18:22:30 +02:00
parent 355095ce7d
commit c9f1825c3c
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -29,7 +29,7 @@ export default function useBackendResource(
if(!allowRetrieve) { if(!allowRetrieve) {
throw new ViewNotAllowedError("retrieve") throw new ViewNotAllowedError("retrieve")
} }
return await apiRequest("GET", `${resourcePath}`, undefined, init) return apiRequest("GET", `${resourcePath}`, undefined, init)
}, },
[apiRequest, allowRetrieve, resourcePath], [apiRequest, allowRetrieve, resourcePath],
) )
@ -39,7 +39,7 @@ export default function useBackendResource(
if(!allowEdit) { if(!allowEdit) {
throw new ViewNotAllowedError("edit") throw new ViewNotAllowedError("edit")
} }
return await apiRequest("PUT", `${resourcePath}`, data, init) return apiRequest("PUT", `${resourcePath}`, data, init)
}, },
[apiRequest, allowEdit, resourcePath], [apiRequest, allowEdit, resourcePath],
) )
@ -49,7 +49,7 @@ export default function useBackendResource(
if(!allowDestroy) { if(!allowDestroy) {
throw new ViewNotAllowedError("destroy") throw new ViewNotAllowedError("destroy")
} }
return await apiRequest("DELETE", `${resourcePath}`, undefined, init) return apiRequest("DELETE", `${resourcePath}`, undefined, init)
}, },
[apiRequest, allowDestroy, resourcePath], [apiRequest, allowDestroy, resourcePath],
) )
@ -59,7 +59,7 @@ export default function useBackendResource(
if(!allowAction) { if(!allowAction) {
throw new ViewNotAllowedError("action") throw new ViewNotAllowedError("action")
} }
return await apiRequest(method, `${resourcePath}/${command}`, data, init) return apiRequest(method, `${resourcePath}/${command}`, data, init)
}, },
[apiRequest, allowAction, resourcePath], [apiRequest, allowAction, resourcePath],
) )