Files
talk/src/core/client/stream/fetches/RefreshSettingsQuery.ts
T
Kiwi 4e043638f6 [CORL-239, CORL-128] Support disabled commenting and closed stories in Stream (#2205)
* feat: closed story + disabled commenting

* test: add feature test and fix bugs

* fix: snapshot

* fix: isClosed can't be null

* fix: remove duplicate DeepPartial type

* fix: border color
2019-03-04 23:27:46 +01:00

40 lines
1.0 KiB
TypeScript

import { graphql } from "react-relay";
import { Environment } from "relay-runtime";
import { createFetchContainer, fetchQuery } from "talk-framework/lib/relay";
import { RefreshSettingsQuery as QueryTypes } from "talk-stream/__generated__/RefreshSettingsQuery.graphql";
export type RefreshSettingsVariables = QueryTypes["variables"];
const query = graphql`
query RefreshSettingsQuery($storyID: ID!) {
settings {
...StreamContainer_settings
}
# We also refrech story props that are
# dependent on the settings.
story(id: $storyID) {
closedAt
isClosed
}
}
`;
function fetch(environment: Environment, variables: RefreshSettingsVariables) {
return fetchQuery<QueryTypes["response"]["settings"]>(
environment,
query,
variables,
{ force: true }
);
}
export const withRefreshSettingsFetch = createFetchContainer(
"refreshSettings",
fetch
);
export type RefreshSettingsFetch = (
variables: RefreshSettingsVariables
) => Promise<QueryTypes["response"]["settings"]>;