Skip to content
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

Merged
merged 16 commits into from
Jan 9, 2024

Conversation

EMcQ-BES
Copy link
Contributor

Issue #: WAITP-1351

Changes:

  • Allow requesting a oneTimeLogin token from datatrak-web-server
    • Requires exporting some types, and adding to the models
    • Also adding request type definitions
  • Update Explore Data link to actually link you to tupaia
  • Update tupaia to allow a loginToken to be applied

Copy link
Contributor

@alexd-bes alexd-bes left a 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 () => {
Copy link
Contributor

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

@@ -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);
Copy link
Contributor

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

Copy link
Contributor

@alexd-bes alexd-bes left a 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.

@alexd-bes alexd-bes merged commit 2bd7ce8 into dev Jan 9, 2024
42 checks passed
@alexd-bes alexd-bes deleted the waitp-1351-datatrak-tupaia-login-link branch January 9, 2024 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants