mirror of
https://github.com/wassname/talk.git
synced 2026-07-09 11:28:28 +08:00
4e043638f6
* 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
40 lines
1.0 KiB
TypeScript
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"]>;
|