Skip to content

Commit

Permalink
redirect settings to home when hyphe server down
Browse files Browse the repository at this point in the history
  • Loading branch information
boogheta committed Jul 7, 2021
1 parent c01fa75 commit e97b9d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hyphe_frontend/app/js/service_hyphe_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ angular.module('hyphe.service_hyphe_api', [])
)

ns.list_tlds = undefined
ns.downloadCorpusTLDs = function(callback){
ns.downloadCorpusTLDs = function(callback, errback){
if (ns.list_tlds) {
callback(ns.list_tlds)
return ns.list_tlds
Expand All @@ -559,6 +559,7 @@ angular.module('hyphe.service_hyphe_api', [])
// called asynchronously if an error occurs
// or server returns response with an error status.
console.error('Impossible to retrieve TLDs', response)
if (errback) errback(response)
})
}
ns.getCorpusTLDs = function(){
Expand Down
5 changes: 5 additions & 0 deletions hyphe_frontend/app/views/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ angular.module('hyphe.settingsController', [])
api.globalStatus({},
function(corpus_status){
$scope.corpus_status = corpus_status
if (!$scope.corpus_status.corpus.traph) {
$location.path('/login')
}
$scope.corpusNotEmpty = !!$scope.corpus_status.corpus.traph.webentities.total
$scope.options = corpus_status.corpus.options
$scope.maxmax_depth = corpus_status.hyphe.max_depth
Expand Down Expand Up @@ -243,6 +246,8 @@ angular.module('hyphe.settingsController', [])
$scope.status = {message: "Error while getting options", background:'danger'}

})
}, function(){
$location.path('/login')
})

}])

0 comments on commit e97b9d0

Please sign in to comment.