Files
talk/src/core/client/stream/mutations/SetStreamOrderByMutation.ts
T
Wyatt JohnsonandGitHub 205e6fcd08 [next] Reaction Sort (#2260)
* feat: stream sort description to use reaction conf

* feat: use full custom translation string for the sort label
2019-04-23 20:50:02 +00:00

32 lines
761 B
TypeScript

import { commitLocalUpdate, Environment } from "relay-runtime";
import { createMutationContainer, LOCAL_ID } from "talk-framework/lib/relay";
export interface SetStreamOrderByInput {
orderBy:
| "CREATED_AT_ASC"
| "CREATED_AT_DESC"
| "REPLIES_DESC"
| "REACTION_DESC"
| "%future added value";
}
export type SetStreamOrderByMutation = (
input: SetStreamOrderByInput
) => Promise<void>;
export async function commit(
environment: Environment,
input: SetStreamOrderByInput
) {
return commitLocalUpdate(environment, store => {
const record = store.get(LOCAL_ID)!;
record.setValue(input.orderBy, "streamOrderBy");
});
}
export const withSetStreamOrderByMutation = createMutationContainer(
"setStreamOrderBy",
commit
);