From 3b34189961a43532730fe2ad2760196b6b1c93c1 Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Thu, 28 Sep 2017 00:27:52 -0700 Subject: [PATCH] Fixed redirect after document delete --- frontend/scenes/DocumentDelete/DocumentDelete.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/scenes/DocumentDelete/DocumentDelete.js b/frontend/scenes/DocumentDelete/DocumentDelete.js index 0a8799c7d..2e3896903 100644 --- a/frontend/scenes/DocumentDelete/DocumentDelete.js +++ b/frontend/scenes/DocumentDelete/DocumentDelete.js @@ -3,7 +3,6 @@ import React, { Component } from 'react'; import { withRouter } from 'react-router-dom'; import { observable } from 'mobx'; import { inject, observer } from 'mobx-react'; -import { homeUrl } from 'utils/routeHelpers'; import Button from 'components/Button'; import Flex from 'components/Flex'; import HelpText from 'components/HelpText'; @@ -24,11 +23,11 @@ type Props = { handleSubmit = async (ev: SyntheticEvent) => { ev.preventDefault(); this.isDeleting = true; + const { collection } = this.props.document; const success = await this.props.document.delete(); if (success) { - this.props.documents.remove(this.props.document.id); - this.props.history.push(homeUrl()); + this.props.history.push(collection.url); this.props.onSubmit(); }