-
Notifications
You must be signed in to change notification settings - Fork 7
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
WAITP-1351 Datatrak link to tupaia and log in #5217
Conversation
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.
Looks good! Just a couple of changes on the FE from me
<SurveyAlertContent> | ||
<ButtonWrapper> | ||
<ButtonLink to={ROUTES.SURVEY_SELECT}>Select survey</ButtonLink> | ||
<Button variant="outlined" onClick={async () => { |
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 think that because the logic here is more than just 1 line, we should move this out from being inline. I also think that we should make this a mutation
that we call on click, and then onSuccess
it can open Tupaia using the login token that is returned
packages/tupaia-web/src/Routes.tsx
Outdated
@@ -52,6 +53,15 @@ const UserPageRedirect = ({ modal }: { modal: MODAL_ROUTES }) => { | |||
* | |||
* **/ | |||
export const Routes = () => { | |||
const [urlSearchParams] = useSearchParams(); | |||
const { mutate: attemptLogin } = useOneTimeLogin(); | |||
const token = urlSearchParams.get(URL_SEARCH_PARAMS.ONE_TIME_LOGIN_TOKEN); |
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'd probably suggest moving this into it's own custom hook, and then calling the custom hook from here. Just because there are a few lines of logic but all related to this one thing, and it keeps it contained
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.
A couple of small comments from me, but otherwise looking really nice. Thanks for the changes. Pre-approving.
Issue #: WAITP-1351
Changes:
oneTimeLogin
token fromdatatrak-web-server
Explore Data
link to actually link you to tupaialoginToken
to be applied