Skip to content

Conversation

@mpblocky
Copy link
Contributor

@mpblocky mpblocky commented Apr 10, 2025

Issue tracking

HUM-164

Context behind the change

  • added new http api clients: authorized, unauthorized, auth service
  • migrated all endpoints to use it
  • removed dead code related to fetcher

How has this been tested?

  • tested every endpoint to ensure it works as before

Release plan

normal

Potential risks; What to monitor; Rollback plan

Monitor incorrect requests in case there was something that was omitted during testing

@vercel
Copy link

vercel bot commented Apr 10, 2025

@mpblocky is attempting to deploy a commit to the HUMAN Protocol Team on Vercel.

A member of the Team first needs to authorize it.

@mpblocky mpblocky force-pushed the HUM-164-refactor-refactor-fetcher-into-http-api-client branch 2 times, most recently from a0ea793 to 0926d51 Compare April 11, 2025 10:41
@mpblocky mpblocky changed the title chore: add new http api client files feat: add new http api client Apr 15, 2025
@mpblocky mpblocky marked this pull request as ready for review April 15, 2025 10:51
@mpblocky
Copy link
Contributor Author

@dnechay This one is ready. I know it's huge but I tried to commit every piece separately for easier review. LMK if You need something!

@mpblocky mpblocky marked this pull request as draft April 16, 2025 09:07
@mpblocky
Copy link
Contributor Author

@dnechay small fixes for my jobs needed, will let You know

@mpblocky mpblocky force-pushed the HUM-164-refactor-refactor-fetcher-into-http-api-client branch from c9b54b4 to 01acc6f Compare April 16, 2025 09:28
@mpblocky mpblocky marked this pull request as ready for review April 16, 2025 10:00
@mpblocky
Copy link
Contributor Author

@dnechay ready

@dnechay dnechay self-requested a review April 16, 2025 10:03
@vercel
Copy link

vercel bot commented Apr 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
human-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 23, 2025 8:43am

Copy link
Collaborator

@dnechay dnechay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTTP clients & auth handling lgtm as for now
Some comments below

  1. You don't have to create an instance of HttpApiClient or AuthorizedHttpApiClient in every specific service, they all have the same base api url, so you can create these instances once and simply use them later w/o wrapping in any classes, e.g.
import { humanAppApiClient } from '@/api';
...
const result = await humanAppApiClient.post<SignatureData>(
  apiPaths.web3.prepareSignature,
  {
    body: { ...data },
    successSchema: prepareSignatureSuccessSchema,
  }
);

return result;
  1. Deployment fails due to build errors, please check them

@mpblocky mpblocky force-pushed the HUM-164-refactor-refactor-fetcher-into-http-api-client branch from 6990ba3 to 8c7cc37 Compare April 19, 2025 16:03
@mpblocky mpblocky requested a review from dnechay April 19, 2025 16:25
@mpblocky
Copy link
Contributor Author

@dnechay everything addressed

Copy link
Collaborator

@dnechay dnechay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks better!

Two comments from previous review are still actual: №1, №2 and some minor items to cleanup

  1. "Reset Password" functionality is not working due to absence of h_captcha_token in payload
  2. After registering address for worker, tokens are refreshed, but Register button is still there. Seems like some extra step need for updating user state when doing authService.refreshAccessToken

@mpblocky mpblocky changed the title feat: add new http api client [HUM-164]: feat: add new http api client Apr 22, 2025
@mpblocky mpblocky force-pushed the HUM-164-refactor-refactor-fetcher-into-http-api-client branch from 5d56be3 to 89c02d0 Compare April 22, 2025 12:14
@mpblocky mpblocky requested a review from dnechay April 22, 2025 12:28
@mpblocky
Copy link
Contributor Author

@dnechay fixed!

Copy link
Collaborator

@dnechay dnechay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

  1. Please resolve merge conflicts
  2. On example of OperatorProfileService.enableOperator, could you please make this and similar methods where we expect "fire & forget" to look like
async enableOperator(signature: string) {
  try {
    await authorizedHumanAppApiClient.post(
      apiPaths.enableOperator,
      {
        body: { signature },
      }
    );
  } catch (error) {
    ...
  }

so it's clear that it's not expected to handle any return value from it

@mpblocky mpblocky force-pushed the HUM-164-refactor-refactor-fetcher-into-http-api-client branch from 2517a38 to 7505ece Compare April 23, 2025 07:44
@dnechay dnechay merged commit 08daa67 into humanprotocol:develop Apr 23, 2025
5 of 9 checks passed
@dnechay dnechay mentioned this pull request Apr 23, 2025
5 tasks
flopez7 pushed a commit that referenced this pull request May 21, 2025
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