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 3

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

View file

@ -31,7 +31,7 @@ export default function useBackendViewset(resourcesPath, pkName,
if(!allowList) { if(!allowList) {
throw new ViewNotAllowedError("list") throw new ViewNotAllowedError("list")
} }
return await apiRequest("GET", `${resourcesPath}`, undefined, init) return apiRequest("GET", `${resourcesPath}`, undefined, init)
}, },
[apiRequest, allowList, resourcesPath], [apiRequest, allowList, resourcesPath],
) )
@ -41,7 +41,7 @@ export default function useBackendViewset(resourcesPath, pkName,
if(!allowRetrieve) { if(!allowRetrieve) {
throw new ViewNotAllowedError("retrieve") throw new ViewNotAllowedError("retrieve")
} }
return await apiRequest("GET", `${resourcesPath}${id}`, undefined, init) return apiRequest("GET", `${resourcesPath}${id}`, undefined, init)
}, },
[apiRequest, allowRetrieve, resourcesPath], [apiRequest, allowRetrieve, resourcesPath],
) )
@ -51,7 +51,7 @@ export default function useBackendViewset(resourcesPath, pkName,
if(!allowCreate) { if(!allowCreate) {
throw new ViewNotAllowedError("create") throw new ViewNotAllowedError("create")
} }
return await apiRequest("POST", `${resourcesPath}`, data, init) return apiRequest("POST", `${resourcesPath}`, data, init)
}, },
[apiRequest, allowCreate, resourcesPath], [apiRequest, allowCreate, resourcesPath],
) )
@ -61,7 +61,7 @@ export default function useBackendViewset(resourcesPath, pkName,
if(!allowEdit) { if(!allowEdit) {
throw new ViewNotAllowedError("edit") throw new ViewNotAllowedError("edit")
} }
return await apiRequest("PUT", `${resourcesPath}${id}`, data, init) return apiRequest("PUT", `${resourcesPath}${id}`, data, init)
}, },
[apiRequest, allowEdit, resourcesPath], [apiRequest, allowEdit, resourcesPath],
) )
@ -71,7 +71,7 @@ export default function useBackendViewset(resourcesPath, pkName,
if(!allowDestroy) { if(!allowDestroy) {
throw new ViewNotAllowedError("destroy") throw new ViewNotAllowedError("destroy")
} }
return await apiRequest("DELETE", `${resourcesPath}${id}`, undefined, init) return apiRequest("DELETE", `${resourcesPath}${id}`, undefined, init)
}, },
[apiRequest, allowDestroy, resourcesPath], [apiRequest, allowDestroy, resourcesPath],
) )
@ -81,7 +81,7 @@ export default function useBackendViewset(resourcesPath, pkName,
if(!allowCommand) { if(!allowCommand) {
throw new ViewNotAllowedError("command") throw new ViewNotAllowedError("command")
} }
return await apiRequest(method, `${resourcesPath}${command}`, data, init) return apiRequest(method, `${resourcesPath}${command}`, data, init)
}, },
[apiRequest, allowCommand, resourcesPath], [apiRequest, allowCommand, resourcesPath],
) )
@ -91,7 +91,7 @@ export default function useBackendViewset(resourcesPath, pkName,
if(!allowAction) { if(!allowAction) {
throw new ViewNotAllowedError("action") throw new ViewNotAllowedError("action")
} }
return await apiRequest(method, `${resourcesPath}${id}/${command}`, data, init) return apiRequest(method, `${resourcesPath}${id}/${command}`, data, init)
}, },
[apiRequest, allowAction, resourcesPath], [apiRequest, allowAction, resourcesPath],
) )