mirror of
https://github.com/wassname/talk.git
synced 2026-07-25 13:30:59 +08:00
fixed merge error
This commit is contained in:
@@ -5,7 +5,6 @@ import { compose, gql } from 'react-apollo';
|
||||
import DownloadCommentHistory from '../components/DownloadCommentHistory';
|
||||
import { withRequestDownloadLink } from '../hocs';
|
||||
import { connect, withFragments } from 'plugin-api/beta/client/hocs';
|
||||
import { withRequestDownloadLink } from '../hocs';
|
||||
import { notify } from 'coral-framework/actions/notification';
|
||||
|
||||
class DownloadCommentHistoryContainer extends Component {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { withMutation } from 'plugin-api/beta/client/hocs';
|
||||
import { gql } from 'react-apollo';
|
||||
import moment from 'moment';
|
||||
import update from 'immutability-helper';
|
||||
|
||||
export const withRequestDownloadLink = withMutation(
|
||||
gql`
|
||||
@@ -17,3 +19,93 @@ export const withRequestDownloadLink = withMutation(
|
||||
}),
|
||||
}
|
||||
);
|
||||
|
||||
export const withRequestAccountDeletion = withMutation(
|
||||
gql`
|
||||
mutation RequestAccountDeletion {
|
||||
requestAccountDeletion {
|
||||
...RequestAccountDeletionResponse
|
||||
}
|
||||
}
|
||||
`,
|
||||
{
|
||||
props: ({ mutate }) => ({
|
||||
requestAccountDeletion: () => {
|
||||
return mutate({
|
||||
variables: {},
|
||||
update: proxy => {
|
||||
const RequestAccountDeletionQuery = gql`
|
||||
query Talk_CancelAccountDeletion {
|
||||
me {
|
||||
id
|
||||
scheduledDeletionDate
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const prev = proxy.readQuery({
|
||||
query: RequestAccountDeletionQuery,
|
||||
});
|
||||
|
||||
const scheduledDeletionDate = moment()
|
||||
.add(24, 'hours')
|
||||
.toDate();
|
||||
|
||||
const data = update(prev, {
|
||||
me: {
|
||||
scheduledDeletionDate: { $set: scheduledDeletionDate },
|
||||
},
|
||||
});
|
||||
|
||||
proxy.writeQuery({
|
||||
query: RequestAccountDeletionQuery,
|
||||
data,
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
}),
|
||||
}
|
||||
);
|
||||
|
||||
export const withCancelAccountDeletion = withMutation(
|
||||
gql`
|
||||
mutation RequestDownloadLink {
|
||||
cancelAccountDeletion {
|
||||
...CancelAccountDeletionResponse
|
||||
}
|
||||
}
|
||||
`,
|
||||
{
|
||||
props: ({ mutate }) => ({
|
||||
cancelAccountDeletion: () => {
|
||||
return mutate({
|
||||
variables: {},
|
||||
update: proxy => {
|
||||
const CancelAccountDeletionQuery = gql`
|
||||
query Talk_CancelAccountDeletion {
|
||||
me {
|
||||
id
|
||||
scheduledDeletionDate
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const prev = proxy.readQuery({ query: CancelAccountDeletionQuery });
|
||||
|
||||
const data = update(prev, {
|
||||
me: {
|
||||
scheduledDeletionDate: { $set: null },
|
||||
},
|
||||
});
|
||||
|
||||
proxy.writeQuery({
|
||||
query: CancelAccountDeletionQuery,
|
||||
data,
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
}),
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user