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

Ajustando métodos getBalance e getFeed #8

Merged
merged 1 commit into from
Feb 20, 2022

Conversation

matheuscouto
Copy link
Contributor

Percebi que os métodos getBalance e getFeed estão utilizando a estrutura errada de retorno do graphQL e sempre retornam undefined por isso. Para consertar fiz as alterações abaixo:

getBalance de:

  public async getBalance(): Promise<number> {
    const data = await this._context.http.graphql(
      GqlOperations.QUERY_ACCOUNT_BALANCE
    );
    return data.viewer?.savingsAccount?.currentSavingsBalance?.netAmount;
  }

para:

  public async getBalance(): Promise<number> {
    const { data } = await this._context.http.graphql(
      GqlOperations.QUERY_ACCOUNT_BALANCE
    );
    return data.viewer?.savingsAccount?.currentSavingsBalance?.netAmount;
  }

getFeed de:

  public async getFeed(): Promise<AccountTransaction[]> {
    const data = await this._context.http.graphql(
      GqlOperations.QUERY_ACCOUNT_FEED
    );
    return data?.viewer?.savingsAccount?.feed;
  }

para:

  public async getFeed(): Promise<AccountTransaction[]> {
    const { data } = await this._context.http.graphql(
      GqlOperations.QUERY_ACCOUNT_FEED
    );
    return data?.viewer?.savingsAccount?.feed;
  }

@fmsouza fmsouza merged commit 00a8d55 into fmsouza:master Feb 20, 2022
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