-
Notifications
You must be signed in to change notification settings - Fork 80
fix: package list refresh based on logged-in user #415
Conversation
description: In `pages/home/Home.tsx` now monitoring any change in a user log-in/out which will trigger a new `API.request` to get the _packages_ from the Verdaccio-server. This is done by creating a `useEffect` on **isUserLoggedIn**. Code has been transplanted from `App/App.tsx` including the use of the Loading component during the XHR. The use of **packages** was removed from other components as no longer needed and tests updated. Resolves issue #414
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @coolsp good job
There is something we need to keep on mind and worth to document on the website. In our local dev config we have the following
security:
api:
jwt:
sign:
expiresIn: 120d
notBefore: 1
web:
sign:
expiresIn: 100d
notBefore: 1
Let's focus on notBefore: 1
for web section for a second. According the docs
https://github.com/auth0/node-jsonwebtoken#jwtsignpayload-secretorprivatekey-options-callback
notBefore: expressed in seconds or a string describing a time span zeit/ms.
Eg: 60, "2 days", "10h", "7d". A numeric value is interpreted as a seconds count. If you use a string be sure you provide the time units (days, hours, etc), otherwise milliseconds unit is used by default ("120" is equal to "120ms").
If the user has something different than notBefore: 0
it will get the following error in the console and the refresh won't work (which is the case of this repo https://github.com/verdaccio/ui/blob/master/tools/_verdaccio.config.yaml#L26).
So, as I suggested, worth to document it either
Please run |
description: In `pages/home/Home.tsx` now monitoring any change in a user log-in/out which will trigger a new `API.request` to get the _packages_ from the Verdaccio-server. This is done by creating a `useEffect` on **isUserLoggedIn**. Code has been transplanted from `App/App.tsx` including the use of the Loading component during the XHR. The use of **packages** was removed from other components as no longer needed and tests updated. Test snapshots updated Resolves issue #414
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Codecov Report
@@ Coverage Diff @@
## master #415 +/- ##
=========================================
Coverage ? 88.45%
=========================================
Files ? 137
Lines ? 953
Branches ? 196
=========================================
Hits ? 843
Misses ? 99
Partials ? 11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test snapshots updated
Thanks so much for fixing this! |
Type: fix
Description:
In
pages/home/Home.tsx
now monitoring any change in a user log-in/out which will trigger a newAPI.request
to get the packages from the Verdaccio-server. This is done by creating auseEffect
on isUserLoggedIn. Code has been transplanted fromApp/App.tsx
including the use of the Loading component during the XHR. The use of packages was removed from other components as no longer needed and tests updated.Resolves #414