Fakultas Ilmu Komputer UI

Commit f86c1bbb authored by Zamil Majdy's avatar Zamil Majdy
Browse files

#140654507 #13 Add login redirection

parent 874fb146
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, browserHistory } from 'react-router';
import { Segment, Modal, Button, Icon, Image as ImageComponent, Item, TextArea, Forms } from 'semantic-ui-react';
import { Router, Route, browserHistory, Redirect } from 'react-router';
import { Segment } from 'semantic-ui-react';
import Dashboard from './Dashboard';
import Login from './Login';
import VacancyPage from './VacancyPage';
import CompanyRegister from './CompanyRegister';
import Server from './lib/Server';
// import Register from './CompanyRegister'
import Pane from './components/Pane';
import Tabs from './components/Tabs';
import ModalAlert from './components/ModalAlert';
export const Profile = () => (
<Segment>
......@@ -17,21 +15,33 @@ export const Profile = () => (
</Segment>
);
export const App = () => (
<Router history={browserHistory}>
<Route path="/login" component={Login} />
<Route path="/register" component={CompanyRegister} />
{/*<Route path="/register" component={Register} />*/}
<Route component={Dashboard}>
<Route path="/" component={Profile} />
<Route path="profile" component={Profile} />
<Route path="lowongan" component={VacancyPage} />
<Route path="users" component={Profile} />
</Route>
</Router>
);
const paragraph = <ImageComponent src="http://semantic-ui.com/images/wireframe/short-paragraph.png" />;
const imageWireFrame = <Item.Image size="small" src="http://semantic-ui.com/images/wireframe/image.png" />;
export default class App extends React.Component {
constructor(props) {
super(props);
/* istanbul ignore next */
this.handleAuth = this.handleAuth.bind(this);
}
handleAuth = (nextState, replace) => (
Server.isLoggedIn() || replace({ pathname: '/login' })
);
render = () => (
<Router history={browserHistory}>
<Route path="/login" component={Login} />
<Route path="/register" component={CompanyRegister} />
<Route component={Dashboard} onEnter={this.handleAuth}>
<Route path="/" component={Profile} />
<Route path="profile" component={Profile} />
<Route path="lowongan" component={VacancyPage} />
<Route path="users" component={Profile} />
</Route>
<Redirect from="*" to="/login" />
</Router>
);
}
ReactDOM.render(<App />, document.getElementById('react-app'));
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment