Fix delete category issue

feature/appm-store/pbac
Jayasanka 6 years ago
parent c0ff4ba34d
commit 62d6abe68e

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

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

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

Loading…
Cancel
Save