/
facet-app.module.js
84 lines (69 loc) · 2.17 KB
/
facet-app.module.js
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
(function() {
'use strict';
/* eslint-disable angular/no-service-method */
// Module definition, note the dependency.
angular.module('facetApp', [
'ui.router',
'seco.facetedSearch'
])
//.constant('google', google)
.constant('_', _) // eslint-disable-line no-undef
.value('SPARQL_ENDPOINT_URL', 'https://ldf.fi/snellman/sparql')
//.value('SPARQL_ENDPOINT_URL', 'http://localhost:3041/ds/sparql')
.run(function ($rootScope, $state, $stateParams) {
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
})
.run(function(authStorage) {
authStorage.init();
})
.config(function($urlMatcherFactoryProvider) {
$urlMatcherFactoryProvider.strictMode(false);
})
.config(function($urlRouterProvider){
$urlRouterProvider.when('', '/texts');
})
.service('authInterceptor', function ($q, $state) {
this.responseError = function(response) {
// console.log(response.status);
if (response.status == 401) {
$state.go('login');
}
return $q.reject(response);
};
})
.config(function($httpProvider) {
$httpProvider.interceptors.push('authInterceptor');
})
// .config(function($locationProvider) {
// $locationProvider.html5Mode(true);
// })
.config(function($stateProvider) {
$stateProvider
.state('login', {
url: '/login',
templateUrl: 'views/login.html',
controller: 'LoginController',
controllerAs: 'vm'
})
.state('texts', {
url: '/texts',
abstract: true,
})
.state('texts.demo', {
url: '?facets',
//url: '/finds',
templateUrl: 'views/pahe.html',
controller: 'PaheFacetController',
controllerAs: 'vm',
reloadOnSearch: false,
redirectTo: 'texts.demo.list'
})
.state('texts.demo.list', {
url: '/list',
templateUrl: 'views/pahe_list.html',
controller: 'PaheController',
controllerAs: 'vm'
})
})
})();