web3.storage
web3.storage copied to clipboard
fix: do not make pins request if the user does not have access #2117
Do not try to fetch pin requests if the user does not have access.
Website preview 🔗✨
- 🙂 https://w3s.link/ipfs/bafybeicwsrudmxm5tbjbadm5wkp2otfaomlq2p4dg3deb3poaw7y7taydq
- ⛅️ https://c91517ea.web3-storage-staging.pages.dev
build log
The server should be verifying this. Is this not the case already?
The user should not reach this view if they don't have access - they won't see the tabs and the table will not be loaded.
@alanshaw thanks for the review, some context:
The server should be verifying this. Is this not the case already?
Yes it is.
The user should not reach this view if they don't have access - they won't see the tabs and the table will not be loaded.
The user does reach the view, more specifically the PinRequestsTable
in FileManager
is displayed if pin requests count > 0. To get the count, the FileManager
uses the usePinRequests
hook which tries to fetch the pin requests and throws an error (which is not handled) if the user does not have access. This leads to an error in the console log in prod which I was trying to avoid for the meantime with this PR, while I was working on https://github.com/web3-storage/web3.storage/issues/1947.
I marked this as draft and I'm doing some better improvements here https://github.com/web3-storage/web3.storage/pull/2147, let me know if there's anything that doesn't make sense, or any suggestions :)