Fakultas Ilmu Komputer UI

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

[Install] add moment.js

parent 8483327f
import React from 'react';
import ReactDOM from 'react-dom';
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 HomeCompany from './HomeCompany';
import CreateVacancy from './CreateVacancy';
import Server from './lib/Server';
import Storage from './lib/Storage';
export const Profile = () => (
<Segment>
<img src="http://semantic-ui.com/images/wireframe/media-paragraph.png" alt="wire-frame" />
</Segment>
);
export default class App extends React.Component {
constructor(props) {
......@@ -31,22 +25,20 @@ export default class App extends React.Component {
handleHome= (nextState, replace, cb) => {
if (Server.isLoggedIn()) {
Storage.getUserData().then((data) => {
const next = data.student ? '/lowongan' : '/profile';
replace({ pathname: next }); cb();
Storage.getUserData().then(() => {
replace({ pathname: '/lowongan' }); cb();
});
} else {
replace({ pathname: '/login' });
}
return replace({ pathname: '/login' });
};
render = () => (
<Router history={browserHistory}>
<Route path="/login" component={Login} />
<Route component={Dashboard} onEnter={this.handleAuth}>
<Route path="/profile" component={Profile} />
<Route path="/lowongan" component={VacancyPage} />
<Route path="/users" component={Profile} />
<Route path="/perusahaan" component={HomeCompany} />
<Route path="/buat-lowongan" component={CreateVacancy} />
</Route>
<Route path="/home" onEnter={this.handleHome} />
<Redirect from="*" to="/home" />
......
......@@ -10,7 +10,7 @@ module.exports = function (config) {
flags: ['--no-sandbox', '--disable-web-security', '--headless', '--disable-gpu', '--remote-debugging-port=9222']
}
},
singleRun: true, // just run once by default
singleRun: false, // just run once by default
frameworks: [ 'mocha', 'chai' ], // use the mocha test framework
files: [
'tests.webpack.js' // just load this file
......
......@@ -8,7 +8,8 @@
"build-production": "webpack -p --config webpack.prod.config.js --progress --colors",
"webpack": "webpack --progress --display-error-details --config webpack.config.js --watch",
"watch": "node server.js",
"karma": "karma start"
"karma": "karma start --single-run",
"test": "karma start --auto-watch"
},
"author": "",
"license": "ISC",
......@@ -46,6 +47,7 @@
"karma-webpack": "^2.0.3",
"mocha": "^3.2.0",
"mock-cookie": "^0.3.2",
"moment": "^2.18.1",
"react-hot-loader": "^3.0.0-beta.5",
"react-test-utils": "0.0.1",
"webpack": "^1.13.2",
......@@ -59,6 +61,7 @@
"object-assign": "^4.1.1",
"react": "^15.4.2",
"react-addons-test-utils": "^15.4.2",
"react-datepicker": "^0.44.0",
"react-dom": "^15.4.2",
"react-router": "^3.0.2",
"react-tap-event-plugin": "^2.0.1",
......
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