Fix fragments and queries

This commit is contained in:
Chi Vinh Le
2018-08-24 14:11:09 +02:00
parent 65a212b531
commit d8b5b00adc
12 changed files with 59 additions and 55 deletions
@@ -114,7 +114,7 @@ export default async function createContext({
pym,
eventEmitter,
registerClickFarAway,
rest: new RestClient("/api"),
rest: new RestClient("/api", tokenGetter),
postMessage: new PostMessageService(),
localStorage: createLocalStorage(),
sessionStorage: createSessionStorage(),
@@ -23,6 +23,8 @@ export async function commit(
} else {
localStorage.removeItem("authToken");
}
// Increment auth revision to indicate a change in auth state.
record.setValue(record.getValue("authRevision") + 1, "authRevision");
// Force gc to trigger.
environment
@@ -6,9 +6,13 @@ import { commit as setAuthToken } from "./SetAuthTokenMutation";
export type SignOutMutation = () => Promise<void>;
export async function commit(environment: Environment, ctx: TalkContext) {
await setAuthToken(environment, { authToken: "" }, ctx);
export async function commit(
environment: Environment,
input: undefined,
ctx: TalkContext
) {
await signOut(ctx.rest);
await setAuthToken(environment, { authToken: "" }, ctx);
}
export const withSignOutMutation = createMutationContainer("signOut", commit);