Implement post comment mutation

This commit is contained in:
Chi Vinh Le
2018-08-30 10:23:03 +02:00
parent 60afa5518a
commit c66c5a1ade
5 changed files with 79 additions and 24 deletions
@@ -0,0 +1,16 @@
declare module "relay-runtime" {
export const ROOT_ID: string;
}
import { Environment, ROOT_ID } from "relay-runtime";
export default function getMe(environment: Environment) {
const source = environment.getStore().getSource();
const root = source.get(ROOT_ID)!;
const meKey = Object.keys(root).find(s => s.startsWith("me("))!;
if (!root[meKey]) {
return null;
}
const meID = root[meKey].__ref;
return source.get(meID)!;
}
@@ -0,0 +1 @@
export { default as getMe } from "./getMe";