Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import * as $ from 'jquery';
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap';
import './style.css';
const Delegate = require('./lib/Delegate');
const nginxService = require('./lib/NginxService');
const config = require('../config.json');
//App view components
const Header = require('./components/header');
const Main = require('./components/main');
//Default state
let state = {
header: {
title: 'Data Portal',
menu: [
{id: 'sign-out-header', name: 'Sign Out'}
]
},
main: {
docs: []
}
};
const app = document.querySelector('#app');
const renderApp = function (data, into) {
console.log('rendering')
into.innerHTML = [Header(data), Main(data)].join('');
};
const renderLoading = function () {
let loading = `
<section class="center">
<div>loading</div>
</section>
`
state.main = loading;
renderApp(state, app)
};
(async () => {
const res = await nginxService({uri: '/solr/ocflcore'});
state.main.docs = res['response']['docs'];
console.log(state);
renderApp(state, app);
})();