-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.js
42 lines (42 loc) · 1.36 KB
/
app.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
angular
.module('app', ['config', 'spinnerModule', 'ngStorage', 'posts', 'authorizationModule'])
.config(function ($provide, $logProvider, DEBUG_ENABLED, REPOSITORY_NAME) {
$logProvider.debugEnabled(DEBUG_ENABLED)
$provide.constant('BASE_API_URL', 'https://api.github.com/repos/' + REPOSITORY_NAME)
})
.directive('main', function () {
return {
restrict: 'E',
templateUrl: 'template/layout/main.html',
};
})
.directive('header', function () {
return {
restrict: 'A',
templateUrl: 'template/layout/header.html',
};
})
.directive('content', function () {
return {
restrict: 'A',
templateUrl: 'template/content/main.html',
};
})
.directive('footer', function ($anchorScroll) {
return {
restrict: 'A',
templateUrl: 'template/layout/footer.html',
link: function ($scope) {
$scope.scrollToTop = () => {
$anchorScroll()
}
}
};
})
.run(function ($http, $localStorage, Base64Encoder) {
if ($localStorage.github?.token) {
const token = Base64Encoder.decode($localStorage.github?.token);
$http.defaults.headers.common.Authorization = 'token ' + token;
}
})
;