mirror of
https://github.com/wassname/talk.git
synced 2026-07-26 13:37:38 +08:00
Adding the mutation
This commit is contained in:
@@ -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
|
||||
);
|
||||
Reference in New Issue
Block a user