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

create interfaces for reducers #5

Open
ColeWalker opened this issue Aug 30, 2020 · 3 comments
Open

create interfaces for reducers #5

ColeWalker opened this issue Aug 30, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers low priority typescript

Comments

@ColeWalker
Copy link
Owner

low priority since it works right now, but this will be good for the future

@ColeWalker ColeWalker added enhancement New feature or request good first issue Good for newcomers labels Aug 30, 2020
@darkusss
Copy link

darkusss commented Sep 2, 2020

Hi, let me a try

@ColeWalker
Copy link
Owner Author

Absolutely!

@ColeWalker
Copy link
Owner Author

interface ChatUserLinkResolverType {
  Chat: {
    user: (
      chat: Chat,
      _args: any,
      { user_id, secret, refresh_token }: GraphQLModules.Context
    ) => Promise<HelixUser | null>
  }
}

export const ChatUserLinkResolvers: ChatUserLinkResolverType = {
  Chat: {
    user: async (
      chat: Chat,
      _args: any,
      { user_id, secret, refresh_token }: GraphQLModules.Context
    ) => {
      const authProvider = await RefreshToken(user_id, secret, refresh_token)
      const twitchClient = new ApiClient({ authProvider, preAuth: true })

      return twitchClient.helix.users.getUserByName(chat.displayName)
    },
  },
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers low priority typescript
Projects
None yet
Development

No branches or pull requests

2 participants