fetchCurrentUser.ts 336 Bytes
import { Context } from "../";
import User from "entity/User";

export default async (root: {}, {}, context: Context) => {
  const { connection, session } = context;
  const userRepo = connection.getRepository(User);
  const userId = session.id;
  const user = await userRepo.findOneById(userId);
  console.log(user);
  return user;
};