return post('/api/projects/bulk_delete', parameters);
}
-export function deleteProject(project: string): Promise<void> {
- return post('/api/projects/delete', { project });
+export function deleteProject(project: string): Promise<void | Response> {
+ return post('/api/projects/delete', { project }).catch(throwGlobalError);
+}
+
+export function deletePortfolio(portfolio: string): Promise<void | Response> {
+ return post('/api/views/delete', { key: portfolio }).catch(throwGlobalError);
}
export function createProject(data: {
import React from 'react';
import PropTypes from 'prop-types';
import Modal from 'react-modal';
-import { deleteProject } from '../../../api/components';
+import { deleteProject, deletePortfolio } from '../../../api/components';
import { translate, translateWithParameters } from '../../../helpers/l10n';
export default class Form extends React.PureComponent {
handleSubmit = event => {
event.preventDefault();
this.setState({ loading: true });
- deleteProject(this.props.component.key)
+ const { component } = this.props;
+ const deleteMethod = component.qualifier === 'TRK' ? deleteProject : deletePortfolio;
+ deleteMethod(component.key)
.then(() => this.context.router.replace('/'))
.catch(this.stopLoading);
};