From 2a5cc97de9df4456946f8d838e2a5bb788f3a42b Mon Sep 17 00:00:00 2001 From: jayasanka Date: Tue, 19 Mar 2019 21:42:57 +0530 Subject: [PATCH] Fixed routing --- .../react-app/package.json | 3 ++- .../react-app/src/App.js | 16 +++++++++------- .../react-app/src/pages/dashboard/index.js | 19 +++++++++++++++++++ .../react-app/src/pages/login.js | 17 +++++++++++++++++ 4 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/index.js create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/login.js diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json index ec52c2e3b8..57761af6ca 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json @@ -13,7 +13,8 @@ "antd": "^3.15.0", "react": "^16.8.4", "react-dom": "^16.8.4", - "react-scripts": "2.1.8" + "react-scripts": "2.1.8", + "react-router-dom": "latest" }, "devDependencies": { "@babel/core": "^7.0.0", 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 5c76e235ec..717d6fd7c3 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 @@ -1,17 +1,19 @@ import React from "react"; -import { version, Button } from 'antd'; import "antd/dist/antd.css"; import "./index.css"; +import {BrowserRouter, Route, Switch} from 'react-router-dom'; +import Dashboard from "./pages/dashboard" +import Login from "./pages/login" class App extends React.Component { render() { return ( -
-

Current antd version: {version}

-

Please fork this codesandbox to reproduce your issue.

-

请 fork 这个链接来重现你碰到的问题。

- -
+ + + + + + ); } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/index.js new file mode 100644 index 0000000000..cc31b7f9ad --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/index.js @@ -0,0 +1,19 @@ +import React from "react"; +import { version, Button } from 'antd'; +import {Link} from 'react-router-dom'; + +class Dashboard extends React.Component { + render() { + return ( +
+

Currentdddddd antd version: {version}

+

Please fork this codesandbox to reproduce your issue.

+

请 fork 这个链接来重现你碰到的问题。

+ login + +
+ ); + } +} + +export default Dashboard; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/login.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/login.js new file mode 100644 index 0000000000..3694ec0107 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/login.js @@ -0,0 +1,17 @@ +import React from "react"; +import { version, Button } from 'antd'; + +class Login extends React.Component { + render() { + return ( +
+

Current antd version: {version}

+

Please fork this codesandbox to reproduce your issue.

+

请 fork 这个链接来重现你碰到的问题。

+ +
+ ); + } +} + +export default Login;