mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 08:52:26 +00:00
Redirection after record deletion
This commit is contained in:
parent
6267955b41
commit
1baf70727d
@ -25,7 +25,15 @@ import { translationMessages } from './i18n';
|
|||||||
// Plugin identifier based on the package.json `name` value
|
// Plugin identifier based on the package.json `name` value
|
||||||
const pluginId = require('../package.json').name.replace(/^strapi-plugin-/i, '');
|
const pluginId = require('../package.json').name.replace(/^strapi-plugin-/i, '');
|
||||||
|
|
||||||
|
// Define Strapi admin router
|
||||||
|
let router;
|
||||||
|
|
||||||
class comp extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
class comp extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
||||||
|
componentWillMount() {
|
||||||
|
// Expose Strapi admin router
|
||||||
|
router = this.context.router;
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
@ -35,6 +43,10 @@ class comp extends React.Component { // eslint-disable-line react/prefer-statele
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
comp.contextTypes = {
|
||||||
|
router: React.PropTypes.object.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
// Register the plugin
|
// Register the plugin
|
||||||
if (window.Strapi) {
|
if (window.Strapi) {
|
||||||
window.Strapi.registerPlugin({
|
window.Strapi.registerPlugin({
|
||||||
@ -71,4 +83,5 @@ export {
|
|||||||
store,
|
store,
|
||||||
apiUrl,
|
apiUrl,
|
||||||
pluginId,
|
pluginId,
|
||||||
|
router,
|
||||||
};
|
};
|
||||||
|
@ -2,6 +2,7 @@ import { takeLatest } from 'redux-saga';
|
|||||||
import { put, select, fork, call } from 'redux-saga/effects';
|
import { put, select, fork, call } from 'redux-saga/effects';
|
||||||
import request from 'utils/request';
|
import request from 'utils/request';
|
||||||
import { browserHistory } from 'react-router';
|
import { browserHistory } from 'react-router';
|
||||||
|
import { router } from 'app';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
recordLoaded,
|
recordLoaded,
|
||||||
@ -80,7 +81,9 @@ export function* deleteRecord() {
|
|||||||
|
|
||||||
yield put(recordDeleted());
|
yield put(recordDeleted());
|
||||||
window.Strapi.notification.success('The entry has been successfully deleted.');
|
window.Strapi.notification.success('The entry has been successfully deleted.');
|
||||||
// TODO: Redirect to the list page.
|
|
||||||
|
// Redirect to the list page.
|
||||||
|
router.push(`/plugins/content-manager/${currentModelName}`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
yield put(recordDeleteError());
|
yield put(recordDeleteError());
|
||||||
window.Strapi.notification.error('An error occurred during record deletion.');
|
window.Strapi.notification.error('An error occurred during record deletion.');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user