fixed merge error

This commit is contained in:
Wyatt Johnson
2018-05-03 15:45:43 -06:00
parent 35cefd5570
commit b5958d5879
2 changed files with 92 additions and 1 deletions
@@ -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,
});
},
});
},
}),
}
);