Files
talk/src/core/client/admin/mutations/SetAuthViewMutation.ts
T
Kiwi 7e8ef2189d [next] Admin Authentication (#2155)
* feat: Support sign in via E-Mail, and social logins + permission check

* feat: no permission info

* test: unit test

* test: fix remaining tests

* test: add integration tests

* feat: add admin account completion

* test: auth completion feature tests

* fix: translation

* fix: comment marker design

* fix: linting issues

* chore: address pr review comments

* chore: add comment
2019-02-04 21:26:41 +00:00

29 lines
873 B
TypeScript

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";
export interface SetAuthViewInput {
// TODO: replace with generated typescript types.
view: "SIGN_IN" | "ADD_EMAIL_ADDRESS" | "CREATE_USERNAME" | "CREATE_PASSWORD";
}
export type SetAuthViewMutation = (input: SetAuthViewInput) => Promise<void>;
export async function commit(
environment: Environment,
input: SetAuthViewInput,
{ pym }: TalkContext
) {
return commitLocalUpdate(environment, store => {
const record = store.get(LOCAL_ID)!;
record.setValue(input.view, "authView");
});
}
export const withSetAuthViewMutation = createMutationContainer(
"setAuthView",
commit
);