Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
ulakbus-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ulakbus
ulakbus-ui
Commits
71d8ed25
Commit
71d8ed25
authored
Oct 14, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
error pages redirect relevant url
parent
cc2ed499
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
8 deletions
+11
-8
.gitignore
.gitignore
+4
-1
Gruntfile.js
Gruntfile.js
+1
-2
directives.js
app/shared/directives.js
+2
-2
interceptors.js
app/zetalib/interceptors.js
+4
-3
No files found.
.gitignore
View file @
71d8ed25
...
@@ -103,4 +103,7 @@ docs/_build/
...
@@ -103,4 +103,7 @@ docs/_build/
# PyBuilder
# PyBuilder
target/
target/
coverage/
coverage/
\ No newline at end of file
sync
*.rdb
\ No newline at end of file
Gruntfile.js
View file @
71d8ed25
...
@@ -298,8 +298,7 @@ module.exports = function (grunt) {
...
@@ -298,8 +298,7 @@ module.exports = function (grunt) {
grunt
.
loadNpmTasks
(
'grunt-preprocess'
);
grunt
.
loadNpmTasks
(
'grunt-preprocess'
);
grunt
.
loadNpmTasks
(
'grunt-env'
);
grunt
.
loadNpmTasks
(
'grunt-env'
);
//grunt.registerTask('dev', ['env:dev', 'preprocess:dev', 'html2js:dev', 'connect:server', 'watch:dev']);
grunt
.
registerTask
(
'dev'
,
[
'env:dev'
,
'preprocess:dev'
,
'html2js:dev'
,
'connect:server'
,
'watch:dev'
]);
grunt
.
registerTask
(
'dev'
,
[
'env:dev'
,
'preprocess:dev'
,
'html2js:dev'
,
'watch:dev'
]);
grunt
.
registerTask
(
'test'
,
[
'bower'
,
'karma:continuous'
]);
grunt
.
registerTask
(
'test'
,
[
'bower'
,
'karma:continuous'
]);
grunt
.
registerTask
(
'i18n'
,
[
'nggettext_extract'
,
'nggettext_compile'
]);
grunt
.
registerTask
(
'i18n'
,
[
'nggettext_extract'
,
'nggettext_compile'
]);
grunt
.
registerTask
(
'default'
,
[
grunt
.
registerTask
(
'default'
,
[
...
...
app/shared/directives.js
View file @
71d8ed25
...
@@ -24,7 +24,7 @@ app.directive('logout', function ($http, $location, RESTURL) {
...
@@ -24,7 +24,7 @@ app.directive('logout', function ($http, $location, RESTURL) {
/**
/**
* headerNotification directive for header
* headerNotification directive for header
*/
*/
app
.
directive
(
'headerNotification'
,
function
(
$http
,
$interval
)
{
app
.
directive
(
'headerNotification'
,
function
(
$http
,
$interval
,
RESTURL
)
{
return
{
return
{
templateUrl
:
'shared/templates/directives/header-notification.html'
,
templateUrl
:
'shared/templates/directives/header-notification.html'
,
restrict
:
'E'
,
restrict
:
'E'
,
...
@@ -32,7 +32,7 @@ app.directive('headerNotification', function ($http, $interval) {
...
@@ -32,7 +32,7 @@ app.directive('headerNotification', function ($http, $interval) {
link
:
function
(
$scope
)
{
link
:
function
(
$scope
)
{
$interval
(
function
()
{
$interval
(
function
()
{
// todo: change url to backend
// todo: change url to backend
$http
.
get
(
"http://google.com
"
).
success
(
function
(
data
)
{
$http
.
post
(
RESTURL
+
"crud
"
).
success
(
function
(
data
)
{
$scope
.
notifications
=
data
;
$scope
.
notifications
=
data
;
});
});
},
15000
);
},
15000
);
...
...
app/zetalib/interceptors.js
View file @
71d8ed25
...
@@ -41,11 +41,11 @@ app.config(['$httpProvider', function ($httpProvider) {
...
@@ -41,11 +41,11 @@ app.config(['$httpProvider', function ($httpProvider) {
},
},
'responseError'
:
function
(
rejection
)
{
'responseError'
:
function
(
rejection
)
{
// if unauthorized then redirect to login page
// if unauthorized then redirect to login page
if
(
rejection
.
status
===
400
)
{
if
(
rejection
.
status
===
400
)
{
$location
.
reload
();
$location
.
reload
();
}
}
if
(
rejection
.
status
===
401
)
{
if
(
rejection
.
status
===
401
)
{
//$rootScope.loggedInUser = false;
if
(
$location
.
path
()
===
"/login"
)
{
if
(
$location
.
path
()
===
"/login"
)
{
console
.
log
(
"show errors on login form"
);
console
.
log
(
"show errors on login form"
);
}
else
{
}
else
{
...
@@ -55,16 +55,17 @@ app.config(['$httpProvider', function ($httpProvider) {
...
@@ -55,16 +55,17 @@ app.config(['$httpProvider', function ($httpProvider) {
if
(
rejection
.
status
===
403
)
{
if
(
rejection
.
status
===
403
)
{
if
(
rejection
.
data
.
is_login
===
true
)
{
if
(
rejection
.
data
.
is_login
===
true
)
{
$rootScope
.
loggedInUser
=
true
;
$rootScope
.
loggedInUser
=
true
;
console
.
log
(
'user logged in'
);
if
(
$location
.
path
()
===
"/login"
)
{
if
(
$location
.
path
()
===
"/login"
)
{
$location
.
path
(
"/dashboard"
);
$location
.
path
(
"/dashboard"
);
}
}
}
}
}
}
if
(
rejection
.
status
===
404
)
{
if
(
rejection
.
status
===
404
)
{
console
.
log
(
404
);
$location
.
path
(
"/404"
);
$location
.
path
(
"/404"
);
}
}
if
(
rejection
.
status
===
500
)
{
// server 500 error returns with -1 on status.
if
(
rejection
.
status
===
-
1
&&
rejection
.
config
.
data
.
model
)
{
$location
.
path
(
"/500"
);
$location
.
path
(
"/500"
);
}
}
return
$q
.
reject
(
rejection
);
return
$q
.
reject
(
rejection
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment