Adding the mutation

This commit is contained in:
Belén Curcio
2018-07-31 11:11:54 -03:00
parent 45e25581f7
commit 466cecda5f
5 changed files with 76 additions and 33 deletions
@@ -0,0 +1,21 @@
import { commitLocalUpdate, Environment } from "relay-runtime";
import { createMutationContainer } from "talk-framework/lib/relay";
import { LOCAL_ID } from "talk-framework/lib/relay/withLocalStateContainer";
export interface SetCommentIDInput {
commentID: string | null;
}
export type SetCommentIDMutation = (input: SetCommentIDInput) => void;
async function commit(environment: Environment, input: SetCommentIDInput) {
return commitLocalUpdate(environment, store => {
const record = store.get(LOCAL_ID)!;
record.setValue(input.commentID, "commentID");
});
}
export const withSetCommentIDMutation = createMutationContainer(
"setCommentID",
commit
);