File size: 309 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
// @flow
import type { GraphQLContext } from '../../';

export default (
  _: any,
  args: { id?: string, username?: string } = {},
  { loaders }: GraphQLContext
) => {
  if (args.id) return loaders.user.load(args.id);
  if (args.username) return loaders.userByUsername.load(args.username);
  return null;
};