-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add API user signup #5
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/ibi-group/otp-admin-ui/2eqemagps |
components/MyLayout.js
Outdated
} | ||
} | ||
|
||
async componentDidUpdate () { |
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.
I feel like all this auth0 stuff shouldn't be in a file dedicated to layouts. A better place would probably be in the pages/_app
file.
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.
Unfortunately that cannot be in pages/_app.js
because the <Auth0Provider>
component is there and provides the auth
props to all the children. It can be in a component between <Auth0Provider>
and <Layout>
.
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.
@binh-dam-ibigroup, see my commits in the demo branch to reorganize some things. It contains an example of how I think some of this stuff should work.
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.
I defer to a discussion we may need to have (#10) regarding how nextjs recommends fetching data.
@@ -15,10 +16,22 @@ export default function Index () { | |||
</div> | |||
) | |||
} | |||
|
|||
if (!isUserFetched) { |
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.
If the user is never fetched, this will continuously show this loading message. There needs to be some logic for what happens when a user is unable to login or doesn't have a login in the first place.
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.
I've fixed this (somewhat) in a recent commit. The issue appears to be that isLoading
from userAuth
is is not working: sandrinodimattia/use-auth0-hooks#14
Also, as @binh-dam-ibigroup mentioned elsewhere, we should probably migrate to https://github.com/auth0/auth0-react during next sprint at some point
* @param {string} method The HTTP method to execute. | ||
* @param {*} options Extra options to pass to fetch. | ||
*/ | ||
export async function secureFetch (url, accessToken, apiKey, method = 'get', options = {}) { |
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.
This should be merged with the secureFetch method contained in #6.
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.
And the snake is biting its tail...
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.
Travis builds are failing. Also see comments.
Also move email verif screen logic to index.js
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.
Leaving a review off for now, but this is just to say that https://github.com/ibi-group/otp-admin-ui/tree/demo contains changes that reflect my thinking on how things could be organized. Perhaps I'll just create a PR into this and make my approval contingent upon that merge.
This PR adds a mechanism for a new API user to sign up from the OTP-admin-ui app:
react-bootstrap
1.0.1 and its CSS,MyLayout
so it can be passed to child components/pages,MyLayout
if email is not verified in Auth0,ApiUserSetup
where new API users enter and save their infoRetrieving and modifying API user data is not implemented (yet).
To test: you need ibi-group/otp-middleware#32.
There are still rough edges from copy-pasting the user fetching code from OTP-RR, so let me know for things that need to be adjusted.