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

[VNDA] - Feat: add user #893

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

[VNDA] - Feat: add user #893

wants to merge 7 commits into from

Conversation

yuriassuncx
Copy link
Contributor

What is this Contribution About?

This Pull Request introduces the implementation of the user hook for integrating VNDA - E-commerce Platform - with Deco.cx. This hook captures the user's accessToken and makes a request to the VNDA API to retrieve the associated user ID.

Changes Made

  1. Utility Function:

    • A utility function was created to extract the accessToken from the user's cookie and make a call to the VNDA API to fetch the user data.
  2. Updated useUser Hook:

    • The useUser hook has been updated to incorporate the new user loading logic.
    • The context structure was adjusted to store user data and loading state.
  3. Loader Implementation:

    • A loader was implemented to make the request to the VNDA API, using the accessToken to retrieve user information.

Issue Link

Please link to the relevant issue that this pull request addresses:

Copy link
Contributor

github-actions bot commented Oct 1, 2024

Tagging Options

Should a new tag be published when this PR is merged?

  • 👍 for Patch 0.59.21 update
  • 🎉 for Minor 0.60.0 update
  • 🚀 for Major 1.0.0 update

@yuriassuncx yuriassuncx changed the title [WIP] VNDA - Feat: add user [VNDA] - Feat: add user Oct 2, 2024
Comment on lines 13 to 23
export const setUserCookie = (headers: Headers, accessToken: string) => {
setCookie(headers, {
name: AUTH_COOKIE,
value: accessToken,
path: "/",
expires: new Date(Date.now() + ONE_WEEK_MS),
httpOnly: true,
secure: true,
sameSite: "Lax",
});
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Não vejo isso sendo usado em nenhum lugar. Quando esse cookie vai ser salvo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Não vejo isso sendo usado em nenhum lugar. Quando esse cookie vai ser salvo?

Pensei em criá-lo para usar em uma futura action de signIn - para remover a necessidade do proxy para a página de login: https://developers.vnda.com.br/reference/post-api-v2-auth-client

Mas atualmente essa action não está criada e fazemos o login por proxy, então real não tem utilidade aqui no momento. Deveria remover?

@IncognitaDev IncognitaDev linked an issue Nov 12, 2024 that may be closed by this pull request
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.

Missing useUser hook in VNDA integration
3 participants