ArboreumDev / credit-union-frontend

Frontend in Next.js + Typescript + GraphQL
https://frontend-two-sandy.vercel.app
1 stars 0 forks source link

Gp/db interaction via client #39

Closed gparuthi closed 4 years ago

gparuthi commented 4 years ago

Adding on top of #34

I finally wrapped my head around to getting an elegant way to organize db queries.

@djudjuu I only added a two queries on the DBClient for you to review.

  import Accounts from "../queries/accounts"

  getUser = async (props: { email: string }) =>
    this._fetcher.request(Accounts.GET_USER_BY_EMAIL, props)

  createUser = async (props: User) =>
    this._fetcher.request(Accounts.CREATE_USER_MUTATION, props)
djudjuu commented 4 years ago

ah, this is the typescript input I needed. thanks!