mirror of
https://github.com/wassname/talk.git
synced 2026-08-01 13:00:55 +08:00
First iteration of admin
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { commitLocalUpdate, Environment } from "relay-runtime";
|
||||
|
||||
import { createMutationContainer } from "talk-framework/lib/relay";
|
||||
import { LOCAL_ID } from "talk-framework/lib/relay/withLocalStateContainer";
|
||||
|
||||
export interface SetViewInput {
|
||||
view: "MODERATE" | "COMMUNITY" | "STORIES" | "CONFIGURE";
|
||||
}
|
||||
|
||||
export type SetViewMutation = (input: SetViewInput) => Promise<void>;
|
||||
|
||||
export async function commit(environment: Environment, input: SetViewInput) {
|
||||
return commitLocalUpdate(environment, store => {
|
||||
const record = store.get(LOCAL_ID)!;
|
||||
record.setValue(input.view, "view");
|
||||
});
|
||||
}
|
||||
|
||||
export const withSetViewMutation = createMutationContainer("setView", commit);
|
||||
Reference in New Issue
Block a user