Fix delete category issue

merge-requests/128/head
Jayasanka 6 years ago
parent c0ff4ba34d
commit 62d6abe68e

@ -65,17 +65,19 @@ class ManageCategories extends React.Component {
"Category Removed Successfully!",
});
console.log("g");
const {categories} = this.state;
const remainingElements = categories.filter(function (value) {
return value.categoryName !== id;
});
this.setState({
loading: false
loading: false,
categories: remainingElements
});
// this.setState({
// categories: [...categories, ...tempElements],
// tempElements: [],
// inputVisible: false,
// inputValue: '',
// loading: false,
// isAddNewVisible: false
// });
}
}).catch((error) => {
@ -135,12 +137,12 @@ class ManageCategories extends React.Component {
};
renderTempElement = (category) => {
const {tempElements} = this.state;
const tagElem = (
<Tag
closable
onClose={e => {
onClose={e=>{
e.preventDefault();
const {tempElements} = this.state;
const remainingElements = tempElements.filter(function (value) {
return value.categoryName !== category.categoryName;

@ -4,9 +4,9 @@ import {Layout, Menu, Icon} from 'antd';
const {Header, Content, Footer} = Layout;
import Logo from "../../../public/images/logo.svg";
import {Link, NavLink} from "react-router-dom";
import {BrowserRouter,Switch,Link, NavLink} from "react-router-dom";
import RouteWithSubRoutes from "../../components/RouteWithSubRoutes"
import {Switch, Redirect} from 'react-router'
import {Redirect} from 'react-router'
import "../../App.css";
class Dashboard extends React.Component {
@ -41,13 +41,15 @@ class Dashboard extends React.Component {
</Layout>
<Layout>
<Content style={{padding: '0 0'}}>
<Switch>
<Redirect exact from="/publisher" to="/publisher/apps"/>
{this.state.routes.map((route) => (
<RouteWithSubRoutes key={route.path} {...route} />
))}
<BrowserRouter>
<Switch>
<Redirect exact from="/publisher" to="/publisher/apps"/>
{this.state.routes.map((route) => (
<RouteWithSubRoutes key={route.path} {...route} />
))}
</Switch>
</Switch>
</BrowserRouter>
</Content>
<Footer style={{textAlign: 'center'}}>

@ -35,7 +35,7 @@ class Manage extends React.Component {
return (
<div>
<PageHeader
breadcrumb={{routes}}
// breadcrumb={{routes}}
title = "Manage"
>
<div className="wrap">

Loading…
Cancel
Save