mirror of
https://github.com/wassname/talk.git
synced 2026-07-25 13:30:59 +08:00
Integrate with embed
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { commitLocalUpdate, Environment } from "relay-runtime";
|
||||
|
||||
import { TalkContext } from "talk-framework/lib/bootstrap";
|
||||
import { createMutationContainer } from "talk-framework/lib/relay";
|
||||
import { LOCAL_ID } from "talk-framework/lib/relay/withLocalStateContainer";
|
||||
|
||||
@@ -8,10 +10,18 @@ export interface SetCommentIDInput {
|
||||
|
||||
export type SetCommentIDMutation = (input: SetCommentIDInput) => Promise<void>;
|
||||
|
||||
async function commit(environment: Environment, input: SetCommentIDInput) {
|
||||
async function commit(
|
||||
environment: Environment,
|
||||
input: SetCommentIDInput,
|
||||
{ pym }: TalkContext
|
||||
) {
|
||||
return commitLocalUpdate(environment, store => {
|
||||
const record = store.get(LOCAL_ID)!;
|
||||
record.setValue(input.id, "commentID");
|
||||
if (pym) {
|
||||
// This sets the comment id on the parent url.
|
||||
pym.sendMessage("setCommentID", input.id || "");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user