From 536a2ca81b5ccd45cec7cd9d23ce8608af0b65ab Mon Sep 17 00:00:00 2001 From: Jayasanka Date: Tue, 26 Mar 2019 22:40:07 +0530 Subject: [PATCH] Created new routes with router config --- .../react-app/src/App.js | 5 - .../src/components/RouteWithSubRoutes.js | 1 - .../react-app/src/index.js | 100 ++---------------- 3 files changed, 7 insertions(+), 99 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/App.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/App.js index f09d174c33..be1c130124 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/App.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/App.js @@ -16,11 +16,6 @@ class App extends React.Component { return (
-
    -
  • Tacos
  • -
  • Sandwiches
  • -
- {this.routes.map((route) => ( ))} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/RouteWithSubRoutes.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/RouteWithSubRoutes.js index d4c5505599..c172b28edd 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/RouteWithSubRoutes.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/RouteWithSubRoutes.js @@ -4,7 +4,6 @@ class RouteWithSubRoutes extends React.Component{ props; constructor(props){ super(props); - console.log(props); this.props = props; } render() { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/index.js index 2478ce8287..2a393bdfbc 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/index.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/index.js @@ -1,75 +1,12 @@ -// import React from 'react'; +import React from 'react'; import ReactDOM from 'react-dom'; -// import './index.css'; +import './index.css'; import * as serviceWorker from './serviceWorker'; -// import { renderRoutes } from "react-router-config"; -// import Dashboard from "./pages/dashboard/Dashboard" -// import Login from "./pages/Login"; -// import {BrowserRouter} from "react-router-dom"; -// -// -// const routes = [ -// { -// component: App, -// routes: [ -// { -// path: "/publisher", -// exact: true, -// component: Dashboard, -// routes: [ -// { -// path: "/publisher/a", -// component: Login -// } -// ] -// }, -// { -// path: "/publisher/login", -// component: Login -// } -// ] -// } -// ]; -// -// ReactDOM.render( -// {/* kick it all off with the root route */} -// {renderRoutes(routes)} -// , document.getElementById('root')); -// -// // If you want your app to work offline and load faster, you can change -// // unregister() to register() below. Note this comes with some pitfalls. -// // Learn more about service workers: https://bit.ly/CRA-PWA -// serviceWorker.unregister(); - - -import React from 'react'; -import { - BrowserRouter as Router, - Route, - Link, -} from 'react-router-dom'; -import RouteWithSubRoutes from "./components/RouteWithSubRoutes" import App from "./App" import Login from "./pages/Login" +import Dashboard from "./pages/dashboard/Dashboard" -const Sandwiches = () =>

Sandwiches

- -const Tacos = ({ routes }) => ( -
-

Tacos

-
    -
  • Bus
  • -
  • Cart
  • -
- - {routes.map((route) => ( - - ))} -
-) -const Bus = () =>

Bus

-const Cart = () =>

Cart

const routes = [ { @@ -77,12 +14,12 @@ const routes = [ component: Login }, { - path: '/publisher/tacos', - component: Tacos, + path: '/publisher/dashboard', + component: Dashboard, routes: [ { - path: '/publisher/tacos/bus', - component: Login + path: '/publisher/dashboard/bus', + component: Bus }, { path: '/publisher/tacos/cart', @@ -92,30 +29,7 @@ const routes = [ } ] -// const RouteWithSubRoutes = (route) => ( -// ( -// -// )}/> -// ) -// class App extends React.Component { -// render() { -// return ( -// -//
-//
    -//
  • Tacos
  • -//
  • Sandwiches
  • -//
-// -// {routes.map((route) => ( -// -// ))} -//
-//
-// ) -// } -// } ReactDOM.render( , document.getElementById('root'));