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
b15909cf
Commit
b15909cf
authored
Jul 02, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
400 hatasında yeniden yükleme ve 401 hatasında login sayfasına yönlendirme
parent
896f3a21
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
app_routes.js
app/app_routes.js
+25
-2
auth_test.js
app/components/auth/auth_test.js
+14
-0
No files found.
app/app_routes.js
View file @
b15909cf
...
@@ -101,7 +101,7 @@ app.config(['$routeProvider', function ($routeProvider) {
...
@@ -101,7 +101,7 @@ app.config(['$routeProvider', function ($routeProvider) {
controller
:
'StaffListCtrl'
,
controller
:
'StaffListCtrl'
,
resolve
:
{
resolve
:
{
loadMyCtrl
:
[
'$ocLazyLoad'
,
function
(
$ocLazyLoad
)
{
loadMyCtrl
:
[
'$ocLazyLoad'
,
function
(
$ocLazyLoad
)
{
return
$ocLazyLoad
.
load
(
'components/st
udent/student
_controller.js'
);
return
$ocLazyLoad
.
load
(
'components/st
aff/staff
_controller.js'
);
}],
}],
loadMyService
:
[
'$ocLazyLoad'
,
function
(
$ocLazyLoad
)
{
loadMyService
:
[
'$ocLazyLoad'
,
function
(
$ocLazyLoad
)
{
return
$ocLazyLoad
.
load
(
'zetalib/forms/form_service.js'
);
return
$ocLazyLoad
.
load
(
'zetalib/forms/form_service.js'
);
...
@@ -144,4 +144,27 @@ app.config(['$routeProvider', function ($routeProvider) {
...
@@ -144,4 +144,27 @@ app.config(['$routeProvider', function ($routeProvider) {
}
}
}
}
});
});
});
}).
config
([
'$httpProvider'
,
function
(
$httpProvider
)
{
\ No newline at end of file
/**
* the interceptor for all requests to check response
* 4xx - 5xx errors will be handled here
*/
$httpProvider
.
interceptors
.
push
(
function
(
$q
)
{
return
{
'response'
:
function
(
response
)
{
//Will only be called for HTTP up to 300
return
response
;
},
'responseError'
:
function
(
rejection
)
{
// if unauthorized then redirect to login page
if
(
rejection
.
status
===
400
)
{
location
.
reload
();
}
if
(
rejection
.
status
===
401
)
{
location
.
path
(
'#/login'
);
}
return
$q
.
reject
(
rejection
);
}
};
});
}]);
\ No newline at end of file
app/components/auth/auth_test.js
View file @
b15909cf
...
@@ -85,5 +85,19 @@ describe('zaerp.auth module', function () {
...
@@ -85,5 +85,19 @@ describe('zaerp.auth module', function () {
})
})
);
);
// todo: test in case of 401 reload
//it('unauthorized 401 should redirect to login',
// inject(function ($httpBackend, $http, $location, $window) {
//
// $httpBackend.whenGET('http://127.0.0.1:8000/#/dashboard').respond(401, '');
//
// $http.get('http://127.0.0.1:8000/#/dashboard');
// expect($window.location == '/#/login');
//
// $httpBackend.flush();
// })
//);
});
});
});
});
\ No newline at end of file
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