mirror of
https://github.com/wassname/talk.git
synced 2026-07-13 17:45:56 +08:00
7e8ef2189d
* 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
29 lines
873 B
TypeScript
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
|
|
);
|